From: Benjamin Tissoires <benjamin.tissoi...@redhat.com> We started switching the driver to devres, so we should use it as much as possible.
Signed-off-by: Benjamin Tissoires <benjamin.tissoi...@redhat.com> Acked-by: Ping Cheng <pi...@wacom.com> Signed-off-by: Jiri Kosina <jkos...@suse.cz> [aaron.sko...@wacom.com: Imported into input-wacom repository (19b6433)] Signed-off-by: Aaron Armstrong Skomra <aaron.sko...@wacom.com> [aaron.sko...@wacom.com: Backported from input-wacom repository (1bdda0a)] Signed-off-by: Aaron Armstrong Skomra <aaron.sko...@wacom.com> --- 2.6.30/wacom_sys.c | 4 +--- 2.6.36/wacom_sys.c | 4 +--- 2.6.38/wacom_sys.c | 5 ++--- 3.17/wacom_sys.c | 4 +--- 3.7/wacom_sys.c | 5 ++--- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/2.6.30/wacom_sys.c b/2.6.30/wacom_sys.c index 4283976..517e293 100644 --- a/2.6.30/wacom_sys.c +++ b/2.6.30/wacom_sys.c @@ -770,7 +770,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i if (intf->cur_altsetting->desc.bNumEndpoints < 1) return -EINVAL; - wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); + wacom = devm_kzalloc(&dev->dev, sizeof(struct wacom), GFP_KERNEL); input_dev = input_allocate_device(); if (!wacom || !input_dev) { error = -ENOMEM; @@ -872,7 +872,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); #endif fail1: input_free_device(input_dev); - kfree(wacom); return error; } @@ -893,7 +892,6 @@ static void wacom_disconnect(struct usb_interface *intf) wacom->wacom_wac.data, wacom->data_dma); #endif wacom_remove_shared_data(&wacom->wacom_wac); - kfree(wacom); } static int wacom_suspend(struct usb_interface *intf, pm_message_t message) diff --git a/2.6.36/wacom_sys.c b/2.6.36/wacom_sys.c index b641c9f..55e54dc 100644 --- a/2.6.36/wacom_sys.c +++ b/2.6.36/wacom_sys.c @@ -858,7 +858,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i if (intf->cur_altsetting->desc.bNumEndpoints < 1) return -EINVAL; - wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); + wacom = devm_kzalloc(&dev->dev, sizeof(struct wacom), GFP_KERNEL); input_dev = input_allocate_device(); if (!wacom || !input_dev) { error = -ENOMEM; @@ -960,7 +960,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i fail3: usb_free_urb(wacom->irq); fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); fail1: input_free_device(input_dev); - kfree(wacom); return error; } @@ -976,7 +975,6 @@ static void wacom_disconnect(struct usb_interface *intf) usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, wacom->wacom_wac.data, wacom->data_dma); wacom_remove_shared_data(&wacom->wacom_wac); - kfree(wacom); } static int wacom_suspend(struct usb_interface *intf, pm_message_t message) diff --git a/2.6.38/wacom_sys.c b/2.6.38/wacom_sys.c index 0c70faf..2ef93fc 100644 --- a/2.6.38/wacom_sys.c +++ b/2.6.38/wacom_sys.c @@ -1630,7 +1630,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i if (intf->cur_altsetting->desc.bNumEndpoints < 1) return -EINVAL; - wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); + wacom = devm_kzalloc(&dev->dev, sizeof(struct wacom), GFP_KERNEL); if (!wacom) return -ENOMEM; @@ -1743,7 +1743,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i fail3: usb_free_urb(wacom->irq); wacom_destroy_battery(wacom); fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); - fail1: kfree(wacom); + fail1: return error; } @@ -1771,7 +1771,6 @@ static void wacom_disconnect(struct usb_interface *intf) wacom->wacom_wac.data, wacom->data_dma); wacom_remove_shared_data(&wacom->wacom_wac); kfree(wacom->wacom_wac.slots); - kfree(wacom); } static int wacom_suspend(struct usb_interface *intf, pm_message_t message) diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c index 6afa06d..070cdaf 100644 --- a/3.17/wacom_sys.c +++ b/3.17/wacom_sys.c @@ -1895,7 +1895,7 @@ static int wacom_probe(struct hid_device *hdev, /* hid-core sets this quirk for the boot interface */ hdev->quirks &= ~HID_QUIRK_NOGET; - wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); + wacom = devm_kzalloc(&hdev->dev, sizeof(struct wacom), GFP_KERNEL); if (!wacom) return -ENOMEM; @@ -1943,7 +1943,6 @@ static int wacom_probe(struct hid_device *hdev, fail_type: fail_parse: - kfree(wacom); hid_set_drvdata(hdev, NULL); return error; } @@ -1970,7 +1969,6 @@ static void wacom_remove(struct hid_device *hdev) wacom_remove_shared_data(wacom); hid_set_drvdata(hdev, NULL); - kfree(wacom); } #ifdef CONFIG_PM diff --git a/3.7/wacom_sys.c b/3.7/wacom_sys.c index b3273f3..d264c62 100644 --- a/3.7/wacom_sys.c +++ b/3.7/wacom_sys.c @@ -1626,7 +1626,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i if (intf->cur_altsetting->desc.bNumEndpoints < 1) return -EINVAL; - wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); + wacom = devm_kzalloc(&dev->dev, sizeof(struct wacom), GFP_KERNEL); if (!wacom) return -ENOMEM; @@ -1739,7 +1739,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i fail3: usb_free_urb(wacom->irq); wacom_destroy_battery(wacom); fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); - fail1: kfree(wacom); + fail1: return error; } @@ -1766,7 +1766,6 @@ static void wacom_disconnect(struct usb_interface *intf) usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, wacom->wacom_wac.data, wacom->data_dma); wacom_remove_shared_data(&wacom->wacom_wac); - kfree(wacom); } static int wacom_suspend(struct usb_interface *intf, pm_message_t message) -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel