Skip to content

Commit 35fe2ad

Browse files
tititiou36groeck
authored andcommitted
hwmon: (nzxt-kraken2) Fix error handling path in kraken2_probe()
There is no point in calling hid_hw_stop() if hid_hw_start() has failed. There is no point in calling hid_hw_close() if hid_hw_open() has failed. Update the error handling path accordingly. Fixes: 82e3430 ("hwmon: add driver for NZXT Kraken X42/X52/X62/X72") Reported-by: Aleksa Savic <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Jonas Malaco <[email protected]> Link: https://lore.kernel.org/r/a768e69851a07a1f4e29f270f4e2559063f07343.1701617030.git.christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <[email protected]>
1 parent 1fefca6 commit 35fe2ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hwmon/nzxt-kraken2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ static int kraken2_probe(struct hid_device *hdev,
161161
ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
162162
if (ret) {
163163
hid_err(hdev, "hid hw start failed with %d\n", ret);
164-
goto fail_and_stop;
164+
return ret;
165165
}
166166

167167
ret = hid_hw_open(hdev);
168168
if (ret) {
169169
hid_err(hdev, "hid hw open failed with %d\n", ret);
170-
goto fail_and_close;
170+
goto fail_and_stop;
171171
}
172172

173173
priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "kraken2",

0 commit comments

Comments
 (0)