Commit 976a54d0 authored by Hanno Zulla's avatar Hanno Zulla Committed by Benjamin Tissoires

HID: hid-bigbenff: call hid_hw_stop() in case of error

It's required to call hid_hw_stop() once hid_hw_start() was called
previously, so error cases need to handle this. Also, hid_hw_close() is
not necessary during removal.
Signed-off-by: default avatarHanno Zulla <kontakt@hanno.de>
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
parent 789a2c25
...@@ -305,7 +305,6 @@ static void bigben_remove(struct hid_device *hid) ...@@ -305,7 +305,6 @@ static void bigben_remove(struct hid_device *hid)
struct bigben_device *bigben = hid_get_drvdata(hid); struct bigben_device *bigben = hid_get_drvdata(hid);
cancel_work_sync(&bigben->worker); cancel_work_sync(&bigben->worker);
hid_hw_close(hid);
hid_hw_stop(hid); hid_hw_stop(hid);
} }
...@@ -350,7 +349,7 @@ static int bigben_probe(struct hid_device *hid, ...@@ -350,7 +349,7 @@ static int bigben_probe(struct hid_device *hid,
error = input_ff_create_memless(hidinput->input, NULL, error = input_ff_create_memless(hidinput->input, NULL,
hid_bigben_play_effect); hid_bigben_play_effect);
if (error) if (error)
return error; goto error_hw_stop;
name_sz = strlen(dev_name(&hid->dev)) + strlen(":red:bigben#") + 1; name_sz = strlen(dev_name(&hid->dev)) + strlen(":red:bigben#") + 1;
...@@ -360,8 +359,10 @@ static int bigben_probe(struct hid_device *hid, ...@@ -360,8 +359,10 @@ static int bigben_probe(struct hid_device *hid,
sizeof(struct led_classdev) + name_sz, sizeof(struct led_classdev) + name_sz,
GFP_KERNEL GFP_KERNEL
); );
if (!led) if (!led) {
return -ENOMEM; error = -ENOMEM;
goto error_hw_stop;
}
name = (void *)(&led[1]); name = (void *)(&led[1]);
snprintf(name, name_sz, snprintf(name, name_sz,
"%s:red:bigben%d", "%s:red:bigben%d",
...@@ -375,7 +376,7 @@ static int bigben_probe(struct hid_device *hid, ...@@ -375,7 +376,7 @@ static int bigben_probe(struct hid_device *hid,
bigben->leds[n] = led; bigben->leds[n] = led;
error = devm_led_classdev_register(&hid->dev, led); error = devm_led_classdev_register(&hid->dev, led);
if (error) if (error)
return error; goto error_hw_stop;
} }
/* initial state: LED1 is on, no rumble effect */ /* initial state: LED1 is on, no rumble effect */
...@@ -389,6 +390,10 @@ static int bigben_probe(struct hid_device *hid, ...@@ -389,6 +390,10 @@ static int bigben_probe(struct hid_device *hid,
hid_info(hid, "LED and force feedback support for BigBen gamepad\n"); hid_info(hid, "LED and force feedback support for BigBen gamepad\n");
return 0; return 0;
error_hw_stop:
hid_hw_stop(hid);
return error;
} }
static __u8 *bigben_report_fixup(struct hid_device *hid, __u8 *rdesc, static __u8 *bigben_report_fixup(struct hid_device *hid, __u8 *rdesc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment