Skip to content

Commit d910774

Browse files
AxelLinSamuel Ortiz
authored andcommitted
mfd: Fix omap_usbhs_alloc_children error handling
1. Return proper error if omap_usbhs_alloc_child fails 2. In the case of goto err_ehci, we should call platform_device_unregister(ehci) instead of platform_device_put(ehci) because we have already added the platform device to device hierarchy. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Axel Lin <[email protected]> Tested-by: Keshava Munegowda <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
1 parent 6eb6fbb commit d910774

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/mfd/omap-usb-host.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ static int omap_usbhs_alloc_children(struct platform_device *pdev)
281281

282282
if (!ehci) {
283283
dev_err(dev, "omap_usbhs_alloc_child failed\n");
284+
ret = -ENOMEM;
284285
goto err_end;
285286
}
286287

@@ -304,13 +305,14 @@ static int omap_usbhs_alloc_children(struct platform_device *pdev)
304305
sizeof(*ohci_data), dev);
305306
if (!ohci) {
306307
dev_err(dev, "omap_usbhs_alloc_child failed\n");
308+
ret = -ENOMEM;
307309
goto err_ehci;
308310
}
309311

310312
return 0;
311313

312314
err_ehci:
313-
platform_device_put(ehci);
315+
platform_device_unregister(ehci);
314316

315317
err_end:
316318
return ret;

0 commit comments

Comments
 (0)