Skip to content

Commit 1746064

Browse files
testacegigroeck
authored andcommitted
hwmon: (corsair-psu) Close HID device on probe errors
corsairpsu_probe() opens the HID device before sending the device init and firmware-info commands. If either command fails, the error path jumps directly to fail_and_stop and skips hid_hw_close(). Use the existing fail_and_close label for those post-open failures so the open count and low-level close callback are balanced before hid_hw_stop(). Fixes: d115b51 ("hwmon: add Corsair PSU HID controller driver") Cc: stable@vger.kernel.org Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Reviewed-by: Wilken Gottwalt <wilken.gottwalt@posteo.net> Link: https://lore.kernel.org/r/20260424135107.13720-1-mhun512@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 1a1414c commit 1746064

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/hwmon/corsair-psu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,13 +796,13 @@ static int corsairpsu_probe(struct hid_device *hdev, const struct hid_device_id
796796
ret = corsairpsu_init(priv);
797797
if (ret < 0) {
798798
dev_err(&hdev->dev, "unable to initialize device (%d)\n", ret);
799-
goto fail_and_stop;
799+
goto fail_and_close;
800800
}
801801

802802
ret = corsairpsu_fwinfo(priv);
803803
if (ret < 0) {
804804
dev_err(&hdev->dev, "unable to query firmware (%d)\n", ret);
805-
goto fail_and_stop;
805+
goto fail_and_close;
806806
}
807807

808808
corsairpsu_get_criticals(priv);

0 commit comments

Comments
 (0)