Commit e2785f0d authored by Kevin Hilman's avatar Kevin Hilman Committed by Russell King

[ARM] 3755/1: dmabounce: fix return value for find_safe_buffer

Patch from Kevin Hilman

Previous locking changes to dmabounce incorrectly return non-NULL even
when buffer not found.  Fix it up.
Signed-off-by: default avatarKevin Hilman <khilman@mvista.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 332158e7
...@@ -179,17 +179,19 @@ alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr, ...@@ -179,17 +179,19 @@ alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr,
static inline struct safe_buffer * static inline struct safe_buffer *
find_safe_buffer(struct dmabounce_device_info *device_info, dma_addr_t safe_dma_addr) find_safe_buffer(struct dmabounce_device_info *device_info, dma_addr_t safe_dma_addr)
{ {
struct safe_buffer *b = NULL; struct safe_buffer *b, *rb = NULL;
unsigned long flags; unsigned long flags;
read_lock_irqsave(&device_info->lock, flags); read_lock_irqsave(&device_info->lock, flags);
list_for_each_entry(b, &device_info->safe_buffers, node) list_for_each_entry(b, &device_info->safe_buffers, node)
if (b->safe_dma_addr == safe_dma_addr) if (b->safe_dma_addr == safe_dma_addr) {
rb = b;
break; break;
}
read_unlock_irqrestore(&device_info->lock, flags); read_unlock_irqrestore(&device_info->lock, flags);
return b; return rb;
} }
static inline void static inline void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment