[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200225191241.GA32410@lxhi-065.adit-jv.com>
Date: Tue, 25 Feb 2020 20:12:41 +0100
From: Eugeniu Rosca <erosca@...adit-jv.com>
To: Alan Stern <stern@...land.harvard.edu>
CC: <linux-usb@...r.kernel.org>, <linux-renesas-soc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
"Lee, Chiasheng" <chiasheng.lee@...el.com>,
Mathieu Malaterre <malat@...ian.org>,
Kai-Heng Feng <kai.heng.feng@...onical.com>,
Hardik Gajjar <hgajjar@...adit-jv.com>,
<scan-admin@...erity.com>, Eugeniu Rosca <erosca@...adit-jv.com>,
Eugeniu Rosca <roscaeugeniu@...il.com>
Subject: Re: [PATCH] usb: hub: Fix unhandled return value of
usb_autopm_get_interface()
Hi Alan,
Many thanks for the prompt review.
On Tue, Feb 25, 2020 at 10:32:32AM -0500, Alan Stern wrote:
> On Tue, 25 Feb 2020, Eugeniu Rosca wrote:
> > + int r = usb_autopm_get_interface(intf);
> > +
> > + if (!r)
> > + hub->quirk_disable_autosuspend = 1;
> > + else
> > + dev_dbg(&intf->dev, "disable autosuspend err=%d\n", r);
> > }
> >
> > if (hub_configure(hub, &desc->endpoint[0].desc) >= 0)
>
> This change is not necessary, because the resume operation cannot fail
> at this point (interfaces are always powered-up during probe).
Agreed to avoid unneeded complexity.
> A better solution would be to call usb_autpm_get_interface_no_resume()
> instead.
Pushed to https://lore.kernel.org/lkml/20200225183057.31953-1-erosca@de.adit-jv.com
>
> On the other hand, the other places that call
> usb_autopm_get_interface() without checking should be audited. Some of
> them almost certainly need to be fixed.
A quick 'git grep' outputs below list of auditable candidates [1].
With no relevant devices at hand, I would avoid touching these drivers,
since oftentimes even legitimate patches introduce regressions w/o
testing.
If anybody volunteers with testing, I guess it should be quick to
either convert usb_autpm_get_interface to *_no_resume variant or
handle the return value in place in below instances.
[1] (v5.6-rc3) git grep -En "[^=]\s+usb_autopm_get_interface\("
drivers/input/touchscreen/usbtouchscreen.c:1788: usb_autopm_get_interface(intf);
drivers/media/usb/stkwebcam/stk-webcam.c:628: usb_autopm_get_interface(dev->interface);
drivers/net/usb/hso.c:1308: usb_autopm_get_interface(serial->parent->interface);
drivers/net/usb/r8152.c:5231: usb_autopm_get_interface(tp->intf);
sound/usb/usx2y/us122l.c:192: usb_autopm_get_interface(iface);
--
Best Regards
Eugeniu Rosca
Powered by blists - more mailing lists