Commit d8c6edfa authored by Jeremy Figgins's avatar Jeremy Figgins Committed by Greg Kroah-Hartman

USB: usblp: don't call usb_set_interface if there's a single alt

Some devices, such as the Winbond Electronics Corp. Virtual Com Port
(Vendor=0416, ProdId=5011), lockup when usb_set_interface() or
usb_clear_halt() are called. This device has only a single
altsetting, so it should not be necessary to call usb_set_interface().
Acked-by: default avatarPete Zaitcev <zaitcev@redhat.com>
Signed-off-by: default avatarJeremy Figgins <kernel@jeremyfiggins.com>
Link: https://lore.kernel.org/r/YAy9kJhM/rG8EQXC@watson
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6ee1d745
...@@ -1329,6 +1329,8 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol) ...@@ -1329,6 +1329,8 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol)
if (protocol < USBLP_FIRST_PROTOCOL || protocol > USBLP_LAST_PROTOCOL) if (protocol < USBLP_FIRST_PROTOCOL || protocol > USBLP_LAST_PROTOCOL)
return -EINVAL; return -EINVAL;
/* Don't unnecessarily set the interface if there's a single alt. */
if (usblp->intf->num_altsetting > 1) {
alts = usblp->protocol[protocol].alt_setting; alts = usblp->protocol[protocol].alt_setting;
if (alts < 0) if (alts < 0)
return -EINVAL; return -EINVAL;
...@@ -1338,6 +1340,7 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol) ...@@ -1338,6 +1340,7 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol)
alts, usblp->ifnum); alts, usblp->ifnum);
return r; return r;
} }
}
usblp->bidir = (usblp->protocol[protocol].epread != NULL); usblp->bidir = (usblp->protocol[protocol].epread != NULL);
usblp->current_protocol = protocol; usblp->current_protocol = protocol;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment