提交 81b77f94 编写于 作者: J Jonathan Cameron 提交者: Greg Kroah-Hartman

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: NJonathan Cameron <jic23@cam.ac.uk>
Reported-by: NMichael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 9a3af585
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册