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>
Wed, 20 Feb 2019 09:09:02 +0000 (10:09 +0100)
commitb2ef4e8f5207d5d44d41d4c7ceefb260a5f95690
tree43d1d1b0d019ada0edab6469dd47c693d6526ea9
parent8aaf06edb200285393d2a9902c12af85f5386eec
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