Commit cbfc6c61 authored by Dan Carpenter's avatar Dan Carpenter Committed by Guenter Roeck

hwmon: (aht10) Unlock on error in aht10_read_values()

This error path needs to drop the lock before returning.

Fixes: afd018716398 ("hwmon: Add AHT10 Temperature and Humidity Sensor Driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YBD5Ro549hMJSnW4@mwandaSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 86585c61
...@@ -138,8 +138,10 @@ static int aht10_read_values(struct aht10_data *data) ...@@ -138,8 +138,10 @@ static int aht10_read_values(struct aht10_data *data)
mutex_lock(&data->lock); mutex_lock(&data->lock);
if (aht10_polltime_expired(data)) { if (aht10_polltime_expired(data)) {
res = i2c_master_send(client, cmd_meas, sizeof(cmd_meas)); res = i2c_master_send(client, cmd_meas, sizeof(cmd_meas));
if (res < 0) if (res < 0) {
mutex_unlock(&data->lock);
return res; return res;
}
usleep_range(AHT10_MEAS_DELAY, usleep_range(AHT10_MEAS_DELAY,
AHT10_MEAS_DELAY + AHT10_DELAY_EXTRA); AHT10_MEAS_DELAY + AHT10_DELAY_EXTRA);
......
Markdown is supported
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