From: Daniel Mack <daniel@xxxxxxxx> cppcheck found another leak in drivers/usb/gadget/imx_udc.c Cc: Mike Lee <eemike@xxxxxxxxx> Cc: Darius Augulis <augulis.darius@xxxxxxxxx> Signed-off-by: Daniel Mack <daniel@xxxxxxxx> Cc: David Brownell <david-b@xxxxxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/usb/gadget/imx_udc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff -puN drivers/usb/gadget/imx_udc.c~usb-imx_udc-fix-leak-in-imx_ep_alloc_request drivers/usb/gadget/imx_udc.c --- a/drivers/usb/gadget/imx_udc.c~usb-imx_udc-fix-leak-in-imx_ep_alloc_request +++ a/drivers/usb/gadget/imx_udc.c @@ -734,9 +734,12 @@ static struct usb_request *imx_ep_alloc_ { 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; _ -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html