HID: wacom: Release device resource data obtained by devres_alloc()

Free device resource data, if __wacom_devm_sysfs_create_group
is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
Arvind Yadav 2018-04-24 13:33:03 +05:30 committed by Jiri Kosina
parent a230cd52b8
commit 097b8f62dd

View File

@ -1213,8 +1213,10 @@ static int __wacom_devm_sysfs_create_group(struct wacom *wacom,
devres->root = root; devres->root = root;
error = sysfs_create_group(devres->root, group); error = sysfs_create_group(devres->root, group);
if (error) if (error) {
devres_free(devres);
return error; return error;
}
devres_add(&wacom->hdev->dev, devres); devres_add(&wacom->hdev->dev, devres);