lkml.org 
[lkml]   [2020]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 04/11] USB: core: hub.c: use usb_control_msg_send() in a few places
On Mon, Sep 07, 2020 at 11:08:58AM -0400, Alan Stern wrote:
> On Mon, Sep 07, 2020 at 04:51:01PM +0200, Greg Kroah-Hartman wrote:
> > There are a few calls to usb_control_msg() that can be converted to use
> > usb_control_msg_send() instead, so do that in order to make the error
> > checking a bit simpler and the code smaller.
> >
> > Cc: Alan Stern <stern@rowland.harvard.edu>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > v2:
> > - dropped changes to usb_req_set_sel() thanks to review from Alan
>
> > @@ -4056,7 +4035,7 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev,
> > * associated with the link state we're about to enable.
> > */
> > ret = usb_req_set_sel(udev, state);
> > - if (ret < 0) {
> > + if (ret) {
> > dev_warn(&udev->dev, "Set SEL for device-initiated %s failed.\n",
> > usb3_lpm_names[state]);
> > return;
>
> Did this change survive by mistake?
>
> Actually, it looks like usb_req_set_sel needs to check the value
> returned by usb_control_msg -- a perfect example of the sort of thing
> you were trying to fix in the first place!

Ugh, good catch, and yes, the original code is buggy :)

thanks,

greg k-h

\
 
 \ /
  Last update: 2020-09-14 17:24    [W:0.078 / U:1.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site