]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iio: adc: max9611: Fix temperature reading in probe
authorJacopo Mondi <jacopo+renesas@jmondi.org>
Mon, 5 Aug 2019 15:55:15 +0000 (17:55 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 5 Aug 2019 16:42:24 +0000 (17:42 +0100)
The max9611 driver reads the die temperature at probe time to validate
the communication channel. Use the actual read value to perform the test
instead of the read function return value, which was mistakenly used so
far.

The temperature reading test was only successful because the 0 return
value is in the range of supported temperatures.

Fixes: 69780a3bbc0b ("iio: adc: Add Maxim max9611 ADC driver")
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/max9611.c

index 0e3c6529fc4c99e4fc30f27e33987254db476e07..da073d72f649f829997f6f3ca9a43c13399aba0d 100644 (file)
@@ -480,7 +480,7 @@ static int max9611_init(struct max9611_dev *max9611)
        if (ret)
                return ret;
 
-       regval = ret & MAX9611_TEMP_MASK;
+       regval &= MAX9611_TEMP_MASK;
 
        if ((regval > MAX9611_TEMP_MAX_POS &&
             regval < MAX9611_TEMP_MIN_NEG) ||