diff --git a/drivers/staging/iio/adc/max1363_ring.c b/drivers/staging/iio/adc/max1363_ring.c index c8aa01109ec2a7c7314282c5aa5662d08de026ef..56688dc9c92f37f073737617627726246e438219 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) /* 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);