Skip to content

Commit

Permalink
iio: adc: max9611: Fix temperature reading in probe
Browse files Browse the repository at this point in the history
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: 69780a3 ("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>
  • Loading branch information
Jacopo Mondi authored and Jonathan Cameron committed Aug 5, 2019
1 parent 82a5008 commit b9ddd50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/adc/max9611.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down

0 comments on commit b9ddd50

Please sign in to comment.