]> git.itanic.dy.fi Git - linux-stable/commitdiff
iio: adc: ab8500-gpadc: Fix off by 10 to 3
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 24 Dec 2020 01:17:00 +0000 (02:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Mar 2021 08:04:15 +0000 (09:04 +0100)
commit 4f5434086d9223f20b3128a7dc78b35271e76655 upstream.

Fix an off by three orders of magnitude error in the AB8500
GPADC driver. Luckily it showed up quite quickly when trying
to make use of it. The processed reads were returning
microvolts, microamperes and microcelsius instead of millivolts,
milliamperes and millicelsius as advertised.

Cc: stable@vger.kernel.org
Fixes: 07063bbfa98e ("iio: adc: New driver for the AB8500 GPADC")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201224011700.1059659-1-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/ab8500-gpadc.c

index 1bb987a4acbabc7b1c41f8e411323fb9d8813297..8d81505282dd336fbc594262ea07e501b4723765 100644 (file)
@@ -918,7 +918,7 @@ static int ab8500_gpadc_read_raw(struct iio_dev *indio_dev,
                        return processed;
 
                /* Return millivolt or milliamps or millicentigrades */
-               *val = processed * 1000;
+               *val = processed;
                return IIO_VAL_INT;
        }