diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2010-05-16 16:29:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-18 17:43:08 -0400 |
commit | 81b77f94a10b64a3620e32531b5d8dbc495f1727 (patch) | |
tree | 666b07ee35e73d0f7eab172d443ac238fd48ca3d /drivers/staging | |
parent | 9a3af585e7fe3df35b233977579b5ab6e4c7005f (diff) |
Staging: iio: max1363 Fix two bugs in single_channel_from_ring
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/iio/adc/max1363_ring.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/iio/adc/max1363_ring.c b/drivers/staging/iio/adc/max1363_ring.c index c8aa01109ec..56688dc9c92 100644 --- a/drivers/staging/iio/adc/max1363_ring.c +++ b/drivers/staging/iio/adc/max1363_ring.c | |||
@@ -51,15 +51,15 @@ int max1363_single_channel_from_ring(long mask, struct max1363_state *st) | |||
51 | /* Need a count of channels prior to this one */ | 51 | /* Need a count of channels prior to this one */ |
52 | mask >>= 1; | 52 | mask >>= 1; |
53 | while (mask) { | 53 | while (mask) { |
54 | if (mask && st->current_mode->modemask) | 54 | if (mask & st->current_mode->modemask) |
55 | count++; | 55 | count++; |
56 | mask >>= 1; | 56 | mask >>= 1; |
57 | } | 57 | } |
58 | if (st->chip_info->bits != 8) | 58 | if (st->chip_info->bits != 8) |
59 | return ((int)(ring_data[count*2 + 0] & 0x0F) << 8) | 59 | ret = ((int)(ring_data[count*2 + 0] & 0x0F) << 8) |
60 | + (int)(ring_data[count*2 + 1]); | 60 | + (int)(ring_data[count*2 + 1]); |
61 | else | 61 | else |
62 | return ring_data[count]; | 62 | ret = ring_data[count]; |
63 | 63 | ||
64 | error_free_ring_data: | 64 | error_free_ring_data: |
65 | kfree(ring_data); | 65 | kfree(ring_data); |