hwmon: (lm80) fix a missing check of bus read in lm80 probe
authorKangjie Lu <kjlu@umn.edu>
Fri, 21 Dec 2018 19:10:39 +0000 (13:10 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:47:16 +0000 (19:47 +0100)
commit040f76976ec5cb332ccdcc734d1c485d87e803a4
tree7d68e09f53940463363ddc085cca9c91aaddd725
parent8dcf84789e311cedeb9782ff361e08808e5b2e8d
hwmon: (lm80) fix a missing check of bus read in lm80 probe

[ Upstream commit 9aa3aa15f4c2f74f47afd6c5db4b420fadf3f315 ]

In lm80_probe(), if lm80_read_value() fails, it returns a negative
error number which is stored to data->fan[f_min] and will be further
used. We should avoid using the data if the read fails.

The fix checks if lm80_read_value() fails, and if so, returns with the
error number.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/lm80.c