Skip to content

Commit

Permalink
[ARM] 3755/1: dmabounce: fix return value for find_safe_buffer
Browse files Browse the repository at this point in the history
Patch from Kevin Hilman

Previous locking changes to dmabounce incorrectly return non-NULL even
when buffer not found.  Fix it up.

Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Kevin Hilman authored and Russell King committed Aug 18, 2006
1 parent 332158e commit e2785f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/arm/common/dmabounce.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,19 @@ alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr,
static inline struct safe_buffer *
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;

read_lock_irqsave(&device_info->lock, flags);

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;
}

read_unlock_irqrestore(&device_info->lock, flags);
return b;
return rb;
}

static inline void
Expand Down

0 comments on commit e2785f0

Please sign in to comment.