From: Dan Carpenter Date: Wed, 27 Jan 2021 05:25:26 +0000 (+0300) Subject: hwmon: (aht10) Unlock on error in aht10_read_values() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cbfc6c6177f9208762c7c4acec394214b1e8be0c;p=linux.git 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 Link: https://lore.kernel.org/r/YBD5Ro549hMJSnW4@mwanda Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c index c70d8c2d0c1fd..2d9770cb4401b 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);