USB: imx_udc: fix leak in imx_ep_alloc_request()
authorDaniel Mack <daniel@caiaq.de>
Tue, 12 May 2009 20:50:34 +0000 (13:50 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 16 Jun 2009 04:44:45 +0000 (21:44 -0700)
cppcheck found another leak in drivers/usb/gadget/imx_udc.c

Cc: Mike Lee <eemike@gmail.com>
Cc: Darius Augulis <augulis.darius@gmail.com>
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/imx_udc.c

index 168658b4b4e26d2bc7b2614cf5b8cb891a3614e5..239bf8ed9f4a445108d0554b8613043098349dff 100644 (file)
@@ -734,9 +734,12 @@ static struct usb_request *imx_ep_alloc_request
 {
        struct imx_request *req;
 
+       if (!usb_ep)
+               return NULL;
+
        req = kzalloc(sizeof *req, gfp_flags);
-       if (!req || !usb_ep)
-               return 0;
+       if (!req)
+               return NULL;
 
        INIT_LIST_HEAD(&req->queue);
        req->in_use = 0;