diff options
author | Jacopo Mondi <jacopo+renesas@jmondi.org> | 2019-08-05 18:55:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-25 11:50:19 +0300 |
commit | 24e808d96068c3ab226fc66c5c6472dd529cd302 (patch) | |
tree | dd07c459aa4605dc77ea40b735d486bf08f0b475 /drivers/iio/adc | |
parent | beed4c284a40347f3203137bdc114a6f2c30b0a5 (diff) | |
download | linux-24e808d96068c3ab226fc66c5c6472dd529cd302.tar.xz |
iio: adc: max9611: Fix temperature reading in probe
commit b9ddd5091160793ee9fac10da765cf3f53d2aaf0 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/max9611.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c index f8f298c33b28..c61fbf560271 100644 --- a/drivers/iio/adc/max9611.c +++ b/drivers/iio/adc/max9611.c @@ -484,7 +484,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) || |