aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-05-14 02:15:36 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-05-26 13:45:50 -0400
commitd910774f13678caf68fc9cbbef325f08f7f951a3 (patch)
treebfe5198e0bffeef1f35fe5dade2fc48bc8c9eba8
parent6eb6fbbf3eca6dfba73e72de5ab2eeb52ae41f7a (diff)
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 <axel.lin@gmail.com> Signed-off-by: Axel Lin <axel.lin@gmail.com> Tested-by: Keshava Munegowda <keshava_mgowda@ti.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/omap-usb-host.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 55c5d4732f5f..1717144fe7f4 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -281,6 +281,7 @@ static int omap_usbhs_alloc_children(struct platform_device *pdev)
281 281
282 if (!ehci) { 282 if (!ehci) {
283 dev_err(dev, "omap_usbhs_alloc_child failed\n"); 283 dev_err(dev, "omap_usbhs_alloc_child failed\n");
284 ret = -ENOMEM;
284 goto err_end; 285 goto err_end;
285 } 286 }
286 287
@@ -304,13 +305,14 @@ static int omap_usbhs_alloc_children(struct platform_device *pdev)
304 sizeof(*ohci_data), dev); 305 sizeof(*ohci_data), dev);
305 if (!ohci) { 306 if (!ohci) {
306 dev_err(dev, "omap_usbhs_alloc_child failed\n"); 307 dev_err(dev, "omap_usbhs_alloc_child failed\n");
308 ret = -ENOMEM;
307 goto err_ehci; 309 goto err_ehci;
308 } 310 }
309 311
310 return 0; 312 return 0;
311 313
312err_ehci: 314err_ehci:
313 platform_device_put(ehci); 315 platform_device_unregister(ehci);
314 316
315err_end: 317err_end:
316 return ret; 318 return ret;