Skip to content

Commit

Permalink
USB: g_printer: fix handling zero-length packet
Browse files Browse the repository at this point in the history
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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
SangSu Park authored and Greg Kroah-Hartman committed Oct 17, 2008
1 parent 0b14c38 commit 8296345
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/usb/gadget/printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8296345

Please sign in to comment.