From 1e0abb7e1844a7cb499321a94d5d04347ef86d68 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Tue, 12 May 2009 13:50:34 -0700 Subject: USB: imx_udc: fix leak in imx_ep_alloc_request() cppcheck found another leak in drivers/usb/gadget/imx_udc.c Cc: Mike Lee Cc: Darius Augulis Signed-off-by: Daniel Mack Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/imx_udc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/usb/gadget') diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c index 168658b4b4e2..239bf8ed9f4a 100644 --- a/drivers/usb/gadget/imx_udc.c +++ b/drivers/usb/gadget/imx_udc.c @@ -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; -- cgit v1.2.3