Commit 17460645 authored by Myeonghun Pak's avatar Myeonghun Pak Committed by Guenter Roeck
Browse files

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: d115b51e ("hwmon: add Corsair PSU HID controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMyeonghun Pak <mhun512@gmail.com>
Reviewed-by: default avatarWilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/20260424135107.13720-1-mhun512@gmail.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 1a1414c6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -796,13 +796,13 @@ static int corsairpsu_probe(struct hid_device *hdev, const struct hid_device_id
	ret = corsairpsu_init(priv);
	if (ret < 0) {
		dev_err(&hdev->dev, "unable to initialize device (%d)\n", ret);
		goto fail_and_stop;
		goto fail_and_close;
	}

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

	corsairpsu_get_criticals(priv);