summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2018-12-26 14:28:24 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-23 11:07:26 +0300
commit82f39f0219441075bdba1aa3e14b5d4b1fa0b481 (patch)
treeafc43404351148c9b768ad1c9dab6d22df153972 /drivers/hwmon
parent718ccdb3ea31c7e4519fcbad37b2cce2585d4215 (diff)
downloadlinux-82f39f0219441075bdba1aa3e14b5d4b1fa0b481.tar.xz
hwmon: (lm80) Fix missing unlock on error in set_fan_div()
commit 07bd14ccc3049f9c0147a91a4227a571f981601a upstream. Add the missing unlock before return from function set_fan_div() in the error handling case. Fixes: c9c63915519b ("hwmon: (lm80) fix a missing check of the status of SMBus read") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm80.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
index 0e30fa00204c..f9b8e3e23a8e 100644
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -393,8 +393,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
}
rv = lm80_read_value(client, LM80_REG_FANDIV);
- if (rv < 0)
+ if (rv < 0) {
+ mutex_unlock(&data->update_lock);
return rv;
+ }
reg = (rv & ~(3 << (2 * (nr + 1))))
| (data->fan_div[nr] << (2 * (nr + 1)));
lm80_write_value(client, LM80_REG_FANDIV, reg);