Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 481d3042 authored by Wei Yongjun's avatar Wei Yongjun Committed by Felipe Balbi
Browse files

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent c3661951
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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)