linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: joystick: pxrc: use usb_get_intf()
@ 2021-07-24 21:36 Salah Triki
  2021-07-25  6:31 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Salah Triki @ 2021-07-24 21:36 UTC (permalink / raw)
  To: Marcus Folkesson, Dmitry Torokhov, gregkh; +Cc: linux-input, linux-kernel

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] input: joystick: pxrc: use usb_get_intf()
  2021-07-24 21:36 [PATCH] input: joystick: pxrc: use usb_get_intf() Salah Triki
@ 2021-07-25  6:31 ` Greg KH
  2021-07-25 18:00   ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-07-25  6:31 UTC (permalink / raw)
  To: Salah Triki; +Cc: Marcus Folkesson, Dmitry Torokhov, linux-input, linux-kernel

On Sat, Jul 24, 2021 at 10:36:17PM +0100, Salah Triki wrote:
> 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 :(

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] input: joystick: pxrc: use usb_get_intf()
  2021-07-25  6:31 ` Greg KH
@ 2021-07-25 18:00   ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2021-07-25 18:00 UTC (permalink / raw)
  To: Greg KH; +Cc: Salah Triki, Marcus Folkesson, linux-input, linux-kernel

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:
> > 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-25 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-24 21:36 [PATCH] input: joystick: pxrc: use usb_get_intf() Salah Triki
2021-07-25  6:31 ` Greg KH
2021-07-25 18:00   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).