Skip to content

Commit 3d422a4

Browse files
caihuoqing1990Jiri Kosina
authored andcommitted
HID: wacom: Make use of the helper function devm_add_action_or_reset()
The helper function devm_add_action_or_reset() will internally call devm_add_action(), and if devm_add_action() fails then it will execute the action mentioned and return the error code. So use devm_add_action_or_reset() instead of devm_add_action() to simplify the error handling, reduce the code. Signed-off-by: Cai Huoqing <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent b764459 commit 3d422a4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/hid/wacom_sys.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -894,11 +894,9 @@ static int wacom_add_shared_data(struct hid_device *hdev)
894894

895895
wacom_wac->shared = &data->shared;
896896

897-
retval = devm_add_action(&hdev->dev, wacom_remove_shared_data, wacom);
898-
if (retval) {
899-
wacom_remove_shared_data(wacom);
897+
retval = devm_add_action_or_reset(&hdev->dev, wacom_remove_shared_data, wacom);
898+
if (retval)
900899
return retval;
901-
}
902900

903901
if (wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH)
904902
wacom_wac->shared->touch = hdev;

0 commit comments

Comments
 (0)