All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Salah Triki <salah.triki@gmail.com>,
	Marcus Folkesson <marcus.folkesson@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] input: joystick: pxrc: use usb_get_intf()
Date: Sun, 25 Jul 2021 11:00:52 -0700	[thread overview]
Message-ID: <YP2m1IG6ilw5aTXH@google.com> (raw)
In-Reply-To: <YP0FU1jMuhcy6wLu@kroah.com>

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

      reply	other threads:[~2021-07-25 18:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YP2m1IG6ilw5aTXH@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcus.folkesson@gmail.com \
    --cc=salah.triki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.