Commit 07bd14cc authored by Wei Yongjun's avatar Wei Yongjun Committed by Guenter Roeck
Browse files

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: c9c63915

 ("hwmon: (lm80) fix a missing check of the status of SMBus read")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 9de15c95
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment