[PATCH v2 04/11] USB: core: hub.c: use usb_control_msg_send() in a few places
Greg Kroah-Hartman
gregkh at linuxfoundation.org
Mon Sep 14 17:23:09 CEST 2020
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 at rowland.harvard.edu>
> > Signed-off-by: Greg Kroah-Hartman <gregkh at 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
More information about the Alsa-devel
mailing list