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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Aug 2019 08:47:59 +0000 (10:47 +0200)
commit367d103a4a937cfdb2fbccdb860099cdb8487180
tree8e8271586ca4dab9e730cdd8ab5efd002dd5caa4
parentdac96992f00aedbf988cb91da3b12cb07b6632d8
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>
drivers/iio/adc/max9611.c