Skip to content

Commit 603fa55

Browse files
dlechmachschmitt
authored andcommitted
iio: adc: ad4000: fix reading unsigned data
Fix reading unsigned data from the AD4000 ADC via the _raw sysfs attribute by ensuring that *val is set before returning from ad4000_single_conversion(). This was not being set in any code path and was causing the attribute to return a random value. Fixes: 938fd56 ("iio: adc: Add support for AD4000") Signed-off-by: David Lechner <dlechner@baylibre.com>
1 parent 9037ac8 commit 603fa55

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iio/adc/ad4000.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ static int ad4000_single_conversion(struct iio_dev *indio_dev,
344344

345345
if (chan->scan_type.sign == 's')
346346
*val = sign_extend32(sample, chan->scan_type.realbits - 1);
347+
else
348+
*val = sample;
347349

348350
return IIO_VAL_INT;
349351
}

0 commit comments

Comments
 (0)