diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-12-26 06:28:24 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-01-06 22:49:14 -0500 |
commit | 07bd14ccc3049f9c0147a91a4227a571f981601a (patch) | |
tree | e607e74e5cb860a6e1c6f85a9403c6bd15934ee0 | |
parent | 9de15c95a63f527c8f7a968cd95e6ec71fc6891d (diff) |
hwmon: (lm80) Fix missing unlock on error in set_fan_div()
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>
-rw-r--r-- | drivers/hwmon/lm80.c | 4 |
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, | |||
393 | } | 393 | } |
394 | 394 | ||
395 | rv = lm80_read_value(client, LM80_REG_FANDIV); | 395 | rv = lm80_read_value(client, LM80_REG_FANDIV); |
396 | if (rv < 0) | 396 | if (rv < 0) { |
397 | mutex_unlock(&data->update_lock); | ||
397 | return rv; | 398 | return rv; |
399 | } | ||
398 | reg = (rv & ~(3 << (2 * (nr + 1)))) | 400 | reg = (rv & ~(3 << (2 * (nr + 1)))) |
399 | | (data->fan_div[nr] << (2 * (nr + 1))); | 401 | | (data->fan_div[nr] << (2 * (nr + 1))); |
400 | lm80_write_value(client, LM80_REG_FANDIV, reg); | 402 | lm80_write_value(client, LM80_REG_FANDIV, reg); |