Skip to content

Commit

Permalink
Staging: iio: max1363 Fix two bugs in single_channel_from_ring
Browse files Browse the repository at this point in the history
This patch contains fixes for the two bugs Michael pointed
out last week.  As the other suggestion Michael made is
not a bug fix (just a much more sensible way of handling
things), I'll do that as a separate patch soon.

The bugs were introduced with the abi changes.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Reported-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed May 18, 2010
1 parent 9a3af58 commit 81b77f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/staging/iio/adc/max1363_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ int max1363_single_channel_from_ring(long mask, struct max1363_state *st)
/* Need a count of channels prior to this one */
mask >>= 1;
while (mask) {
if (mask && st->current_mode->modemask)
if (mask & st->current_mode->modemask)
count++;
mask >>= 1;
}
if (st->chip_info->bits != 8)
return ((int)(ring_data[count*2 + 0] & 0x0F) << 8)
ret = ((int)(ring_data[count*2 + 0] & 0x0F) << 8)
+ (int)(ring_data[count*2 + 1]);
else
return ring_data[count];
ret = ring_data[count];

error_free_ring_data:
kfree(ring_data);
Expand Down

0 comments on commit 81b77f9

Please sign in to comment.