Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Axel Lin and committed by
Samuel Ortiz
d910774f 6eb6fbbf

+3 -1
+3 -1
drivers/mfd/omap-usb-host.c
··· 281 281 282 282 if (!ehci) { 283 283 dev_err(dev, "omap_usbhs_alloc_child failed\n"); 284 + ret = -ENOMEM; 284 285 goto err_end; 285 286 } 286 287 ··· 305 304 sizeof(*ohci_data), dev); 306 305 if (!ohci) { 307 306 dev_err(dev, "omap_usbhs_alloc_child failed\n"); 307 + ret = -ENOMEM; 308 308 goto err_ehci; 309 309 } 310 310 311 311 return 0; 312 312 313 313 err_ehci: 314 - platform_device_put(ehci); 314 + platform_device_unregister(ehci); 315 315 316 316 err_end: 317 317 return ret;