Skip to content

Commit

Permalink
HID: wacom: Fix wacom_probe error handling
Browse files Browse the repository at this point in the history
OLEDs/LED are not critical for tablet functioning thus ignore OLED/LED
initialisation failures.

This patch does clean up all the sysfs attribute files in error paths.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Axel Lin authored and Jiri Kosina committed Sep 19, 2012
1 parent e3c399e commit 8908dd8
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions drivers/hid/hid-wacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,11 +859,9 @@ OLED_INIT(7);
if (hdev->product == USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) {
sprintf(hdev->name, "%s", "Wacom Intuos4 WL");
ret = wacom_initialize_leds(hdev);
if (ret) {
if (ret)
hid_warn(hdev,
"can't create led attribute, err: %d\n", ret);
goto destroy_leds;
}
}

wdata->battery.properties = wacom_battery_props;
Expand All @@ -876,8 +874,8 @@ OLED_INIT(7);

ret = power_supply_register(&hdev->dev, &wdata->battery);
if (ret) {
hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n",
ret);
hid_err(hdev, "can't create sysfs battery attribute, err: %d\n",
ret);
goto err_battery;
}

Expand All @@ -892,8 +890,8 @@ OLED_INIT(7);

ret = power_supply_register(&hdev->dev, &wdata->ac);
if (ret) {
hid_warn(hdev,
"can't create ac battery attribute, err: %d\n", ret);
hid_err(hdev,
"can't create ac battery attribute, err: %d\n", ret);
goto err_ac;
}

Expand All @@ -903,10 +901,17 @@ OLED_INIT(7);
err_ac:
power_supply_unregister(&wdata->battery);
err_battery:
wacom_destroy_leds(hdev);
device_remove_file(&hdev->dev, &dev_attr_oled0_img);
device_remove_file(&hdev->dev, &dev_attr_oled1_img);
device_remove_file(&hdev->dev, &dev_attr_oled2_img);
device_remove_file(&hdev->dev, &dev_attr_oled3_img);
device_remove_file(&hdev->dev, &dev_attr_oled4_img);
device_remove_file(&hdev->dev, &dev_attr_oled5_img);
device_remove_file(&hdev->dev, &dev_attr_oled6_img);
device_remove_file(&hdev->dev, &dev_attr_oled7_img);
device_remove_file(&hdev->dev, &dev_attr_speed);
hid_hw_stop(hdev);
destroy_leds:
wacom_destroy_leds(hdev);
err_free:
kfree(wdata);
return ret;
Expand Down

0 comments on commit 8908dd8

Please sign in to comment.