mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status()
@ 2024-01-22 15:49 Harshit Mogalapalli
  2024-01-23 20:46 ` Aleksa Savic
  2024-01-26 18:40 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Harshit Mogalapalli @ 2024-01-22 15:49 UTC (permalink / raw)
  To: Aleksa Savic, Jean Delvare, Guenter Roeck, linux-hwmon, linux-kernel
  Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli

Goto 'unlock_and_return' for unlocking before returning on the error
path.

Fixes: d5939a793693 ("hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis with smatch, only compile tested.
---
 drivers/hwmon/gigabyte_waterforce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/gigabyte_waterforce.c b/drivers/hwmon/gigabyte_waterforce.c
index 1799377fc2f1..7bccfe2eaa76 100644
--- a/drivers/hwmon/gigabyte_waterforce.c
+++ b/drivers/hwmon/gigabyte_waterforce.c
@@ -146,7 +146,7 @@ static int waterforce_get_status(struct waterforce_data *priv)
 	/* Send command for getting status */
 	ret = waterforce_write_expanded(priv, get_status_cmd, GET_STATUS_CMD_LENGTH);
 	if (ret < 0)
-		return ret;
+		goto unlock_and_return;
 
 	ret = wait_for_completion_interruptible_timeout(&priv->status_report_received,
 							msecs_to_jiffies(STATUS_VALIDITY));
-- 
2.39.3


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

* Re: [PATCH] hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status()
  2024-01-22 15:49 [PATCH] hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status() Harshit Mogalapalli
@ 2024-01-23 20:46 ` Aleksa Savic
  2024-01-26 18:40 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Aleksa Savic @ 2024-01-23 20:46 UTC (permalink / raw)
  To: Harshit Mogalapalli, Jean Delvare, Guenter Roeck, linux-hwmon,
	linux-kernel
  Cc: savicaleksa83, dan.carpenter, kernel-janitors, error27

On 2024-01-22 16:49:52 GMT+01:00, Harshit Mogalapalli wrote:
> Goto 'unlock_and_return' for unlocking before returning on the error
> path.
> 
> Fixes: d5939a793693 ("hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is based on static analysis with smatch, only compile tested.
> ---
>  drivers/hwmon/gigabyte_waterforce.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/gigabyte_waterforce.c b/drivers/hwmon/gigabyte_waterforce.c
> index 1799377fc2f1..7bccfe2eaa76 100644
> --- a/drivers/hwmon/gigabyte_waterforce.c
> +++ b/drivers/hwmon/gigabyte_waterforce.c
> @@ -146,7 +146,7 @@ static int waterforce_get_status(struct waterforce_data *priv)
>  	/* Send command for getting status */
>  	ret = waterforce_write_expanded(priv, get_status_cmd, GET_STATUS_CMD_LENGTH);
>  	if (ret < 0)
> -		return ret;
> +		goto unlock_and_return;
>  
>  	ret = wait_for_completion_interruptible_timeout(&priv->status_report_received,
>  							msecs_to_jiffies(STATUS_VALIDITY));

Reviewed-by: Aleksa Savic <savicaleksa83@gmail.com>

Thanks,
Aleksa

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

* Re: [PATCH] hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status()
  2024-01-22 15:49 [PATCH] hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status() Harshit Mogalapalli
  2024-01-23 20:46 ` Aleksa Savic
@ 2024-01-26 18:40 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2024-01-26 18:40 UTC (permalink / raw)
  To: Harshit Mogalapalli
  Cc: Aleksa Savic, Jean Delvare, linux-hwmon, linux-kernel,
	dan.carpenter, kernel-janitors, error27

On Mon, Jan 22, 2024 at 07:49:52AM -0800, Harshit Mogalapalli wrote:
> Goto 'unlock_and_return' for unlocking before returning on the error
> path.
> 
> Fixes: d5939a793693 ("hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> Reviewed-by: Aleksa Savic <savicaleksa83@gmail.com>

Applied.

Thanks,
Guenter

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

end of thread, other threads:[~2024-01-26 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-22 15:49 [PATCH] hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status() Harshit Mogalapalli
2024-01-23 20:46 ` Aleksa Savic
2024-01-26 18:40 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®