Skip to contentSkip to conversation

input: joystick: pxrc: use usb_get_intf()

PATCH In review Salah Triki 3 participants 3 messages Jul 24, 2021 – Jul 25, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input: joystick: pxrc: use usb_get_intf()

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

---
 drivers/input/joystick/pxrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/pxrc.c +1 -1
index ea2bf5951d67..59304352548b 100644
@@ -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);
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 14 lines · Salah Triki

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

---
 drivers/input/joystick/pxrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/pxrc.c +0 -0
index ea2bf5951d67..59304352548b 100644

drivers/input/joystick/pxrc.c static int pxrc_probe(struct usb_interface *intf, · line 149

Quoted 8 lines
drivers/input/joystick/pxrc.c +1 -1
@@ -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 :(

maintainer
#2 lore raw
Quoted 20 lines · Greg KH
Quoted 19 lines · Salah Triki

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

---
 drivers/input/joystick/pxrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/pxrc.c +1 -1
index ea2bf5951d67..59304352548b 100644
@@ -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);
 
Quoted 5 lines

drivers/input/joystick/pxrc.c static int pxrc_probe(struct usb_interface *intf, · line 149

Quoted 3 lines
drivers/input/joystick/pxrc.c +0 -0
 	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.

Signature · 1 line
Dmitry