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:46:08 +0000 (19:46 +0100)
commit1812be7e56c7c4447c2facdc52d81a872158a957
tree6585faaecd695481b55da33685e83ea33d871f68
parent58ddc0c67d113a1081e3c017682b475b75a6bf2c
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