All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (aht10) Unlock on error in aht10_read_values()
@ 2021-01-27  5:25 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-01-27  5:25 UTC (permalink / raw)
  To: Jean Delvare, Johannes Cornelis Draaijer
  Cc: Guenter Roeck, linux-hwmon, kernel-janitors

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>
---
 drivers/hwmon/aht10.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] hwmon: (aht10) Unlock on error in aht10_read_values()
@ 2021-01-27  5:25 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-01-27  5:25 UTC (permalink / raw)
  To: Jean Delvare, Johannes Cornelis Draaijer
  Cc: Guenter Roeck, linux-hwmon, kernel-janitors

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>
---
 drivers/hwmon/aht10.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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);
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] hwmon: (aht10) Unlock on error in aht10_read_values()
  2021-01-27  5:25 ` Dan Carpenter
@ 2021-01-27 16:47   ` Guenter Roeck
  -1 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2021-01-27 16:47 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jean Delvare, Johannes Cornelis Draaijer, linux-hwmon, kernel-janitors

On Wed, Jan 27, 2021 at 08:25:26AM +0300, Dan Carpenter wrote:
> 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>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hwmon: (aht10) Unlock on error in aht10_read_values()
@ 2021-01-27 16:47   ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2021-01-27 16:47 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jean Delvare, Johannes Cornelis Draaijer, linux-hwmon, kernel-janitors

On Wed, Jan 27, 2021 at 08:25:26AM +0300, Dan Carpenter wrote:
> 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>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-27 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27  5:25 [PATCH] hwmon: (aht10) Unlock on error in aht10_read_values() Dan Carpenter
2021-01-27  5:25 ` Dan Carpenter
2021-01-27 16:47 ` Guenter Roeck
2021-01-27 16:47   ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.