[U-Boot] [PATCH 6/8] USB-CDC: Correct stat_req initialization

Vitaly Kuzmichev vkuzmichev at mvista.com
Thu Aug 12 14:44:44 CEST 2010


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 at mvista.com>
---
 drivers/usb/gadget/ether.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 25d6243..5710ddf 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1739,14 +1739,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
-- 
1.7.1.1



More information about the U-Boot mailing list