Skip to content

Commit

Permalink
usb: gadget: dummy_hcd: fix error return code in init()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Yongjun authored and Felipe Balbi committed May 15, 2013
1 parent c366195 commit 481d304
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/gadget/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2660,8 +2660,10 @@ static int __init init(void)
}
for (i = 0; i < mod_data.num; i++) {
dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL);
if (!dum[i])
if (!dum[i]) {
retval = -ENOMEM;
goto err_add_pdata;
}
retval = platform_device_add_data(the_hcd_pdev[i], &dum[i],
sizeof(void *));
if (retval)
Expand Down

0 comments on commit 481d304

Please sign in to comment.