tablet: acecad: update the reference count of the usb interface structure
Subsystems (2)
PATCH v2 1/1 tablet: acecad: update the reference count of the usb interface structure
Based on the following documentation usb_get_inf(), use usb_get_intf() and usb_put_intf() in order to update the reference count of the usb interface structure.
Documentation of usb_get_inf():
[quote]
Each live reference to a interface must be refcounted.
Drivers for USB interfaces should normally record such references in their probe methods, when they bind to an interface, and release them by calling usb_put_intf, in their disconnect methods. [/quote]
---
Change since v1:
Modification of the description
drivers/input/tablet/acecad.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/input/tablet/acecad.c +4 -1
@@ -151,7 +151,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ goto fail2; } - acecad->intf = intf; + acecad->intf =usb_get_intf (intf); acecad->input = input_dev;if (dev->manufacturer)
@@ -236,6 +236,9 @@ static void usb_acecad_disconnect(struct usb_interface *intf)input_unregister_device (acecad->input);usb_free_urb (acecad->irq);usb_free_coherent (udev,8 , acecad->data, acecad->data_dma); + +usb_put_intf (acecad->intf); +kfree (acecad); }
Signature · 1 line
2.25.1
Quoted 8 lines · Salah Triki
drivers/input/tablet/acecad.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/input/tablet/acecad.c +0
-0
drivers/input/tablet/acecad.c static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ · line 157
Quoted 8 lines
drivers/input/tablet/acecad.c +1
-1@@ -151,7 +151,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ goto fail2; } - acecad->intf = intf; + acecad->intf =usb_get_intf (intf); acecad->input = input_dev;if (dev->manufacturer)
As I mentioned earlier, you need to drop the reference if input_register_device() fails.
regards,
dan carpenter
Greg Kroah-Hartman
maintainerQuoted 12 lines · Dan Carpenter
Quoted 11 lines · Salah Triki
drivers/input/tablet/acecad.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/input/tablet/acecad.c +0
-0@@ -151,7 +151,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ goto fail2; }
Quoted 8 lines
drivers/input/tablet/acecad.c static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ · line 157
Quoted 5 lines
drivers/input/tablet/acecad.c +1
-1- acecad->intf = intf; + acecad->intf =usb_get_intf (intf); acecad->input = input_dev;if (dev->manufacturer)As I mentioned earlier, you need to drop the reference if
input_register_device()fails.
Also as mentioned in other threads, this is not needed at all.
Quoted 9 lines · Salah Triki
Based on the following documentation
usb_get_inf(), useusb_get_intf()andusb_put_intf()in order to update the reference count of the usb interface structure.Documentation of
usb_get_inf():[quote]
Each live reference to a interface must be refcounted.
Quoted 6 lines
Drivers for USB interfaces should normally record such references in their probe methods, when they bind to an interface, and release them by calling
usb_put_intf, in their disconnect methods. [/quote]Signed-off-by Salah Triki <[email protected]>
Also add a Fixes tag.
regards,
dan carpenter