1 From b8043bf2140ad0e4d31a68ee05a4a9dd7cc39bfa Mon Sep 17 00:00:00 2001
2 From: Wei Yongjun <weiyongjun1@huawei.com>
3 Date: Wed, 26 Dec 2018 11:28:24 +0000
4 Subject: hwmon: (lm80) Fix missing unlock on error in set_fan_div()
6 [ Upstream commit 07bd14ccc3049f9c0147a91a4227a571f981601a ]
8 Add the missing unlock before return from function set_fan_div()
9 in the error handling case.
11 Fixes: c9c63915519b ("hwmon: (lm80) fix a missing check of the status of SMBus read")
12 Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
13 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
14 Signed-off-by: Sasha Levin <sashal@kernel.org>
16 drivers/hwmon/lm80.c | 4 +++-
17 1 file changed, 3 insertions(+), 1 deletion(-)
19 diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
20 index 0e30fa00204cd..f9b8e3e23a8e8 100644
21 --- a/drivers/hwmon/lm80.c
22 +++ b/drivers/hwmon/lm80.c
23 @@ -393,8 +393,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
26 rv = lm80_read_value(client, LM80_REG_FANDIV);
29 + mutex_unlock(&data->update_lock);
32 reg = (rv & ~(3 << (2 * (nr + 1))))
33 | (data->fan_div[nr] << (2 * (nr + 1)));
34 lm80_write_value(client, LM80_REG_FANDIV, reg);