USB-CDC: Correct stat_req initialization
authorVitaly Kuzmichev <vkuzmichev@mvista.com>
Fri, 13 Aug 2010 13:01:06 +0000 (17:01 +0400)
committerRemy Bohmer <linux@bohmer.net>
Mon, 20 Sep 2010 19:57:17 +0000 (21:57 +0200)
Fix possible oops on stat_req->buf initialization and fix ep0 and
status_ep confusion (last one is just intended for stat_req keeping).

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>
drivers/usb/gadget/ether.c

index 283049ebe620590f0c7cd69cc52dc4a4524fc9a9..8126f76861a3ad34339bc44013b99584acdd5a96 100644 (file)
@@ -1726,14 +1726,13 @@ autoconf_fail:
        /* ... and maybe likewise for status transfer */
 #if defined(DEV_CONFIG_CDC)
        if (dev->status_ep) {
-               dev->stat_req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
-               dev->stat_req->buf = status_req;
+               dev->stat_req = usb_ep_alloc_request(dev->status_ep, GFP_KERNEL);
                if (!dev->stat_req) {
-                       dev->stat_req->buf=NULL;
-                       usb_ep_free_request (gadget->ep0, dev->req);
+                       usb_ep_free_request (dev->status_ep, dev->req);
 
                        goto fail;
                }
+               dev->stat_req->buf = status_req;
                dev->stat_req->context = NULL;
        }
 #endif