Skip to content

Commit

Permalink
mfd: Fix omap_usbhs_alloc_children error handling
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
AxelLin authored and Samuel Ortiz committed May 26, 2011
1 parent 6eb6fbb commit d910774
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mfd/omap-usb-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ static int omap_usbhs_alloc_children(struct platform_device *pdev)

if (!ehci) {
dev_err(dev, "omap_usbhs_alloc_child failed\n");
ret = -ENOMEM;
goto err_end;
}

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

return 0;

err_ehci:
platform_device_put(ehci);
platform_device_unregister(ehci);

err_end:
return ret;
Expand Down

0 comments on commit d910774

Please sign in to comment.