diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-05-07 07:50:06 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-05-15 10:25:31 -0400 |
commit | 481d30427e5506fc1f5c27bbb94faef9d1ec72a0 (patch) | |
tree | ddefad33841921bd5a51a3128fcc239c17bb1ca0 /drivers/usb/gadget/dummy_hcd.c | |
parent | c3661951032d002d710c2187c5d9dbc8b4cabfa2 (diff) |
usb: gadget: dummy_hcd: fix error return code in init()
Fix to return -ENOMEM in the kzalloc() error handling case instead
of 0(following platform_device_add_data() will overwrite it to 0), as
done elsewhere in this function.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/dummy_hcd.c')
-rw-r--r-- | drivers/usb/gadget/dummy_hcd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 22236ecb2e29..c588e8e486e5 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -2660,8 +2660,10 @@ static int __init init(void) | |||
2660 | } | 2660 | } |
2661 | for (i = 0; i < mod_data.num; i++) { | 2661 | for (i = 0; i < mod_data.num; i++) { |
2662 | dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL); | 2662 | dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL); |
2663 | if (!dum[i]) | 2663 | if (!dum[i]) { |
2664 | retval = -ENOMEM; | ||
2664 | goto err_add_pdata; | 2665 | goto err_add_pdata; |
2666 | } | ||
2665 | retval = platform_device_add_data(the_hcd_pdev[i], &dum[i], | 2667 | retval = platform_device_add_data(the_hcd_pdev[i], &dum[i], |
2666 | sizeof(void *)); | 2668 | sizeof(void *)); |
2667 | if (retval) | 2669 | if (retval) |