aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-08-11 06:10:48 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-23 23:50:16 -0400
commit7c81aafaf059b81ead2330bc13db78269ef62612 (patch)
tree4e98fbe0298e523231fa6b7d470d640d364aa712 /drivers/usb/gadget
parentd187abb9a83e6c6b6e9f2ca17962bdeafb4bc903 (diff)
USB: gadget: Return -ENOMEM on memory allocation failure
In this code, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression ret; expression x,e1,e2,e3; @@ ret = 0 ... when != ret = e1 *x = \(kmalloc\|kcalloc\|kzalloc\)(...) ... when != ret = e2 if (x == NULL) { ... when != ret = e3 return ret; } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/m66592-udc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 166bf71fd34..e03058fe23c 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1609,6 +1609,7 @@ static int __init m66592_probe(struct platform_device *pdev)
1609 /* initialize ucd */ 1609 /* initialize ucd */
1610 m66592 = kzalloc(sizeof(struct m66592), GFP_KERNEL); 1610 m66592 = kzalloc(sizeof(struct m66592), GFP_KERNEL);
1611 if (m66592 == NULL) { 1611 if (m66592 == NULL) {
1612 ret = -ENOMEM;
1612 pr_err("kzalloc error\n"); 1613 pr_err("kzalloc error\n");
1613 goto clean_up; 1614 goto clean_up;
1614 } 1615 }