提交 960f1007 编写于 作者: J Jeremy Figgins 提交者: Zheng Zengkai

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

commit d8c6edfa upstream.

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: NPete Zaitcev <zaitcev@redhat.com>
Signed-off-by: NJeremy Figgins <kernel@jeremyfiggins.com>
Link: https://lore.kernel.org/r/YAy9kJhM/rG8EQXC@watson
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ef35ab2d
...@@ -1327,14 +1327,17 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol) ...@@ -1327,14 +1327,17 @@ 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;
alts = usblp->protocol[protocol].alt_setting; /* Don't unnecessarily set the interface if there's a single alt. */
if (alts < 0) if (usblp->intf->num_altsetting > 1) {
return -EINVAL; alts = usblp->protocol[protocol].alt_setting;
r = usb_set_interface(usblp->dev, usblp->ifnum, alts); if (alts < 0)
if (r < 0) { return -EINVAL;
printk(KERN_ERR "usblp: can't set desired altsetting %d on interface %d\n", r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
alts, usblp->ifnum); if (r < 0) {
return r; printk(KERN_ERR "usblp: can't set desired altsetting %d on interface %d\n",
alts, usblp->ifnum);
return r;
}
} }
usblp->bidir = (usblp->protocol[protocol].epread != NULL); usblp->bidir = (usblp->protocol[protocol].epread != NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册