summaryrefslogtreecommitdiff
path: root/drivers/hwmon/aht10.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-01-27 08:25:26 +0300
committerGuenter Roeck <linux@roeck-us.net>2021-01-28 04:44:19 +0300
commitcbfc6c6177f9208762c7c4acec394214b1e8be0c (patch)
tree183cb55f0d2d9ee0b55ce620c78d360dfcad77fb /drivers/hwmon/aht10.c
parent86585c61972f0997ed5fef54a2eb5de0b268ad86 (diff)
downloadlinux-cbfc6c6177f9208762c7c4acec394214b1e8be0c.tar.xz
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: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YBD5Ro549hMJSnW4@mwanda Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/aht10.c')
-rw-r--r--drivers/hwmon/aht10.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c
index c70d8c2d0c1f..2d9770cb4401 100644
--- a/drivers/hwmon/aht10.c
+++ b/drivers/hwmon/aht10.c
@@ -138,8 +138,10 @@ static int aht10_read_values(struct aht10_data *data)
mutex_lock(&data->lock);
if (aht10_polltime_expired(data)) {
res = i2c_master_send(client, cmd_meas, sizeof(cmd_meas));
- if (res < 0)
+ if (res < 0) {
+ mutex_unlock(&data->lock);
return res;
+ }
usleep_range(AHT10_MEAS_DELAY,
AHT10_MEAS_DELAY + AHT10_DELAY_EXTRA);