From: Renato Lui Geh Date: Thu, 1 Nov 2018 14:43:02 +0000 (-0300) Subject: staging: iio: ad7780: fix offset read value X-Git-Tag: v5.4-rc1~1925^2~249^2~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ccc612b835b5e1560f913ec96ed6fdc7835892e;p=platform%2Fkernel%2Flinux-rpi.git staging: iio: ad7780: fix offset read value Variable val subtracted an uninitialized value on IIO_CHAN_INFO_OFFSET. This was fixed by assigning the correct value instead. Signed-off-by: Renato Lui Geh Acked-by: Alexandru Ardelean Signed-off-by: Jonathan Cameron --- diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c index b67412db0318..91e016d534ed 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -96,7 +96,7 @@ static int ad7780_read_raw(struct iio_dev *indio_dev, *val2 = chan->scan_type.realbits - 1; return IIO_VAL_FRACTIONAL_LOG2; case IIO_CHAN_INFO_OFFSET: - *val -= (1 << (chan->scan_type.realbits - 1)); + *val = -(1 << (chan->scan_type.realbits - 1)); return IIO_VAL_INT; }