A leading zero bit is sent on the bus before the temperature value is transmitted. If this bit is high, the connection might be unstable or it could mean that no AD7314 (or compatible) is connected on the bus. Return -ENXIO in that case. Signed-off-by: Erik Schumacher <erik.schumacher@xxxxxxxxxxxxxxxx> --- drivers/hwmon/ad7314.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index 7802bbf5f958..025846f1f18b 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c @@ -65,6 +65,10 @@ static ssize_t ad7314_temperature_show(struct device *dev, return ret; switch (spi_get_device_id(chip->spi_dev)->driver_data) { case ad7314: + if (ret & BIT(15)) { + /* Invalid read-out, leading zero bit is missing */ + return -ENXIO; + } data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_SHIFT; data = sign_extend32(data, 9); -- 2.48.1