Message ID | 20200907145108.3766613-1-gregkh@linuxfoundation.org (mailing list archive) |
---|---|
Headers | show |
Series | USB: new USB control message helper functions | expand |
On Mon, Sep 07, 2020 at 04:51:00PM +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. > > Cc: Alan Stern <stern@rowland.harvard.edu> > Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Cc: linux-usb@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Oops, Andy, sorry, you gave me a Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> on the previous version of this, I'll add it next round, or when it's queued up. thanks, greg k-h
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! Alan Stern
On Mon, Sep 07, 2020 at 04:56:44PM +0200, Greg Kroah-Hartman wrote: > On Mon, Sep 07, 2020 at 04:51:00PM +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. > > > > Cc: Alan Stern <stern@rowland.harvard.edu> > > Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> > > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Cc: linux-usb@vger.kernel.org > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Oops, Andy, sorry, you gave me a Reviewed-by: Andy Shevchenko > <andriy.shevchenko@linux.intel.com> on the previous version of this, > I'll add it next round, or when it's queued up. NP! Whatever works better for you.
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