[PATCH] input: joystick: pxrc: use usb_get_intf()

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, phoenix rc flight controller adapter, the rest

STALE1902d

3 messages, 3 authors, 2021-07-25 · open the first message on its own page

[PATCH] input: joystick: pxrc: use usb_get_intf()

From: Salah Triki <salah.triki@gmail.com>
Date: 2021-07-24 21:36:25

Use usb_get_intf() in order to increment reference count of the usb
interface structure.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/input/joystick/pxrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c
index ea2bf5951d67..59304352548b 100644
--- a/drivers/input/joystick/pxrc.c
+++ b/drivers/input/joystick/pxrc.c
@@ -143,7 +143,7 @@ static int pxrc_probe(struct usb_interface *intf,
 		return -ENOMEM;
 
 	mutex_init(&pxrc->pm_mutex);
-	pxrc->intf = intf;
+	pxrc->intf = usb_get_intf(intf);
 
 	usb_set_intfdata(pxrc->intf, pxrc);
 
-- 
2.25.1

Re: [PATCH] input: joystick: pxrc: use usb_get_intf()

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2021-07-25 06:32:09

On Sat, Jul 24, 2021 at 10:36:17PM +0100, Salah Triki wrote:
quoted hunk
Use usb_get_intf() in order to increment reference count of the usb
interface structure.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/input/joystick/pxrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c
index ea2bf5951d67..59304352548b 100644
--- a/drivers/input/joystick/pxrc.c
+++ b/drivers/input/joystick/pxrc.c
@@ -143,7 +143,7 @@ static int pxrc_probe(struct usb_interface *intf,
 		return -ENOMEM;
 
 	mutex_init(&pxrc->pm_mutex);
-	pxrc->intf = intf;
+	pxrc->intf = usb_get_intf(intf);
 
 	usb_set_intfdata(pxrc->intf, pxrc);
 
-- 
You can not add a reference and never drop it :(

Re: [PATCH] input: joystick: pxrc: use usb_get_intf()

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2021-07-25 18:01:01

On Sun, Jul 25, 2021 at 08:31:47AM +0200, Greg KH wrote:
On Sat, Jul 24, 2021 at 10:36:17PM +0100, Salah Triki wrote:
quoted
Use usb_get_intf() in order to increment reference count of the usb
interface structure.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/input/joystick/pxrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c
index ea2bf5951d67..59304352548b 100644
--- a/drivers/input/joystick/pxrc.c
+++ b/drivers/input/joystick/pxrc.c
@@ -143,7 +143,7 @@ static int pxrc_probe(struct usb_interface *intf,
 		return -ENOMEM;
 
 	mutex_init(&pxrc->pm_mutex);
-	pxrc->intf = intf;
+	pxrc->intf = usb_get_intf(intf);
 
 	usb_set_intfdata(pxrc->intf, pxrc);
 
-- 
You can not add a reference and never drop it :(
On top of that taking a reference here is not useful as the interface
must be valid until disconnect() call.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help