Skip to content

Commit

Permalink
hwmon: (lm80) Fix missing unlock on error in set_fan_div()
Browse files Browse the repository at this point in the history
Add the missing unlock before return from function set_fan_div()
in the error handling case.

Fixes: c9c6391 ("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>
  • Loading branch information
Wei Yongjun authored and groeck committed Jan 7, 2019
1 parent 9de15c9 commit 07bd14c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/hwmon/lm80.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 07bd14c

Please sign in to comment.