aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iicbus
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2014-10-12 23:48:55 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2014-10-12 23:48:55 +0000
commit6ab4d70393cc22b63dccac9a06c98a00e89b5159 (patch)
tree575941092774621ea8ad393ce7835f1ddc4c66d7 /sys/dev/iicbus
parent62141a34e7af20c4503c1341e0c2d3dcc4ff29ad (diff)
downloadsrc-6ab4d70393cc22b63dccac9a06c98a00e89b5159.tar.gz
src-6ab4d70393cc22b63dccac9a06c98a00e89b5159.zip
Check error return from reading integer part of temperature.
There's a very remote, but possible, chance that the integer part read will fail, but the fraction read succeeds, at which point the reported temperature is invalid. Reported by: Matthew Rezny MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=273016
Diffstat (limited to 'sys/dev/iicbus')
-rw-r--r--sys/dev/iicbus/max6690.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/iicbus/max6690.c b/sys/dev/iicbus/max6690.c
index 5742e179f13d..67bb042b39bd 100644
--- a/sys/dev/iicbus/max6690.c
+++ b/sys/dev/iicbus/max6690.c
@@ -340,6 +340,10 @@ max6690_sensor_read(struct max6690_sensor *sens)
}
err = max6690_read(sc->sc_dev, sc->sc_addr, reg_int, &integer);
+
+ if (err < 0)
+ return (-1);
+
err = max6690_read(sc->sc_dev, sc->sc_addr, reg_ext, &fraction);
if (err < 0)