]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status()
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Mon, 22 Jan 2024 15:49:52 +0000 (07:49 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 26 Jan 2024 18:39:53 +0000 (10:39 -0800)
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>
Link: https://lore.kernel.org/r/20240122154952.2851934-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/gigabyte_waterforce.c

index 85e5237757142a05b45fdd7006d4c7b2ca61a3c3..8129d7b3ceaf9ae2e851f39af2db7aa6eaca9ce0 100644 (file)
@@ -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));