Skip to contentSkip to conversation

mfd: Fix omap_usbhs_alloc_children error handling

PATCH In review Axel Lin 4 participants 4 messages May 14, 2011 – May 22, 2011

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/mfd/omap-usb-host.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mfd/omap-usb-host.c +3 -1
index 3ab9ffa..344f518 100644
@@ -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;
 	}
 
@@ -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;
Signature · 1 line
1.7.1
#1 lore raw
Quoted 36 lines · Axel Lin

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.

---
 drivers/mfd/omap-usb-host.c |    4 +++-

 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mfd/omap-usb-host.c +2 -0
index 3ab9ffa..344f518 100644
@@ -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;
        }
 
@@ -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);

Quoted 5 lines

 err_end:
       return ret;
--
1.7.1

Looks goo to me;

Balbi,
I will take this patch on top of hwmod and runtime pm patches?
is it OK for you.

#2 lore raw

Hi,

Quoted 45 lines · Keshava
Quoted 36 lines · Axel Lin

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.

---
 drivers/mfd/omap-usb-host.c |    4 +++-

 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mfd/omap-usb-host.c +2 -0
index 3ab9ffa..344f518 100644
@@ -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;
        }
 
@@ -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);

Quoted 5 lines

 err_end:
       return ret;
--
1.7.1

Looks goo to me;

Quoted 3 lines

Balbi,
I will take this patch on top of hwmod and runtime pm patches?
is it OK for you.

It's ok. Just be sure to split the series correctly:

arch/arm/*omap*/ -> to Tony
drivers/mfd/* -> to Samuel

Signature · 1 line
balbi
#3 lore raw
In reply to Axel Lin

Hi Axel,

Quoted 4 lines · Axel Lin

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.

Patch applied, thanks a lot.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/