usb: gadget: f_mass_storage: Fix Bulk-only RESET handling
authorRoger Quadros <roger.quadros@nokia.com>
Tue, 5 Apr 2011 15:36:38 +0000 (18:36 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 13 Apr 2011 23:40:59 +0000 (16:40 -0700)
The ep0 request tag was not recorded thus resulting in phase
problems while sending status/response in handle_execption() handler.
This was resulting in MSC compliance test failures with USBCV tool.

With this patch, the Bulk-Only Mass storage RESET request is
handled correctly and the MSC compliance tests pass.

Signed-off-by: Roger Quadros <roger.quadros@nokia.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_mass_storage.c

index 98d6b39061d25c6c1ed9485fa85b8d2fac07c26c..e9de33d1c9a06ec0a1e458f78ee413116a80558b 100644 (file)
@@ -599,6 +599,11 @@ static int fsg_setup(struct usb_function *f,
        if (!fsg_is_set(fsg->common))
                return -EOPNOTSUPP;
 
+       ++fsg->common->ep0_req_tag;     /* Record arrival of a new request */
+       req->context = NULL;
+       req->length = 0;
+       dump_msg(fsg, "ep0-setup", (u8 *) ctrl, sizeof(*ctrl));
+
        switch (ctrl->bRequest) {
 
        case USB_BULK_RESET_REQUEST: