提交 8296345a 编写于 作者: S SangSu Park 提交者: Greg Kroah-Hartman

USB: g_printer: fix handling zero-length packet

g_printer doesn't have to check whether the data size is a multiple of
MaxPacketSize, because device controller driver already make that check.

Signed-off-by: SangSu Park<sangsu@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 0b14c388
......@@ -1278,8 +1278,7 @@ printer_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
/* respond with data transfer before status phase? */
if (value >= 0) {
req->length = value;
req->zero = value < wLength
&& (value % gadget->ep0->maxpacket) == 0;
req->zero = value < wLength;
value = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
if (value < 0) {
DBG(dev, "ep_queue --> %d\n", value);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册