From: Harshit Mogalapalli Date: Mon, 22 Jan 2024 15:49:52 +0000 (-0800) Subject: hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status() X-Git-Tag: v6.8-rc3~17^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=97aab852c4b9e1b378de48a55f8c9b8d76c36ccc;p=thirdparty%2Fkernel%2Flinux.git hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status() 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 Reviewed-by: Aleksa Savic Link: https://lore.kernel.org/r/20240122154952.2851934-1-harshit.m.mogalapalli@oracle.com Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/gigabyte_waterforce.c b/drivers/hwmon/gigabyte_waterforce.c index 85e5237757142..8129d7b3ceaf9 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));