lkml.org 
[lkml]   [2021]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH v2] 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]

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
Change since v1:
Modification of the description

drivers/input/tablet/acecad.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index a38d1fe97334..85fe134a30ee 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -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);
}

--
2.25.1
\
 
 \ /
  Last update: 2021-07-31 18:10    [W:0.072 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site