diff mbox series

iio: adc: ab8500-gpadc: Fix off by 10 to 3

Message ID 20201224011700.1059659-1-linus.walleij@linaro.org
State Accepted
Commit 4f5434086d9223f20b3128a7dc78b35271e76655
Headers show
Series iio: adc: ab8500-gpadc: Fix off by 10 to 3 | expand

Commit Message

Linus Walleij Dec. 24, 2020, 1:17 a.m. UTC
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>

---
 drivers/iio/adc/ab8500-gpadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.29.2

Comments

Jonathan Cameron Feb. 21, 2021, 4:18 p.m. UTC | #1
On Thu, 24 Dec 2020 02:17:00 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:

> 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>

No idea why I didn't pick this up before now.  I guess I forgot it
over xmas.

Anyhow, now applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> ---

>  drivers/iio/adc/ab8500-gpadc.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c

> index 6f9a3e2d5533..7b5212ba5501 100644

> --- a/drivers/iio/adc/ab8500-gpadc.c

> +++ b/drivers/iio/adc/ab8500-gpadc.c

> @@ -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;

>  	}

>
Linus Walleij Feb. 22, 2021, 11:56 p.m. UTC | #2
On Sun, Feb 21, 2021 at 5:18 PM Jonathan Cameron <jic23@kernel.org> wrote:
> On Thu, 24 Dec 2020 02:17:00 +0100

> Linus Walleij <linus.walleij@linaro.org> wrote:


> No idea why I didn't pick this up before now.  I guess I forgot it

> over xmas.

>

> Anyhow, now applied to the fixes-togreg branch of iio.git.


Such things happen, was just gonna poke you about it,
thanks a lot!

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
index 6f9a3e2d5533..7b5212ba5501 100644
--- a/drivers/iio/adc/ab8500-gpadc.c
+++ b/drivers/iio/adc/ab8500-gpadc.c
@@ -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;
 	}