HID: wacom: Make use of the helper function devm_add_action_or_reset()
[sfrench/cifs-2.6.git] / drivers / hid / wacom_sys.c
index 62f50e4b837dcd3e0867bb939a8ff6e81c14fc07..2717d39600b402af0b8b7a1498926468a38239b2 100644 (file)
@@ -894,11 +894,9 @@ static int wacom_add_shared_data(struct hid_device *hdev)
 
        wacom_wac->shared = &data->shared;
 
-       retval = devm_add_action(&hdev->dev, wacom_remove_shared_data, wacom);
-       if (retval) {
-               wacom_remove_shared_data(wacom);
+       retval = devm_add_action_or_reset(&hdev->dev, wacom_remove_shared_data, wacom);
+       if (retval)
                return retval;
-       }
 
        if (wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH)
                wacom_wac->shared->touch = hdev;