Skip to contentSkip to conversation

usb: omap2430: fix memleak in err case

PATCH Superseded Libo Chen 3 participants 9 messages May 15, 2013 – May 29, 2013

Subsystems (4)
lore
Share & tools
lore

Libo Chen

author
#0 lore raw

PATCH 1/1 usb: omap2430: fix memleak in err case

when omap_get_control_dev fail, we should release relational platform_device

---
 drivers/usb/musb/omap2430.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/musb/omap2430.c +2 -1
index 3551f1a..b626f19 100644
@@ -549,7 +549,8 @@ static int omap2430_probe(struct platform_device *pdev)
 		glue->control_otghs = omap_get_control_dev();
 		if (IS_ERR(glue->control_otghs)) {
 			dev_vdbg(&pdev->dev, "Failed to get control device\n");
-			return -ENODEV;
+			ret = -ENODEV;
+			goto err2;
 		}
 	} else {
 		glue->control_otghs = ERR_PTR(-ENODEV);
Signature · 1 line
1.7.1
#1 lore raw

Hello.

Quoted 1 line · Libo Chen

when omap_get_control_dev fail, we should release relational platform_device

s/fail/fails/, s/relational/related/?

Quoted 1 line

You've posted this to the wrong mailing list, linux-mips;
devicetree-discuss also seems hardly related.

WBR, Sergei

author
#2 lore raw
Quoted 6 lines · Sergei Shtylyov

Hello.

Quoted 1 line · Libo Chen

when omap_get_control_dev fail, we should release relational platform_device

Quoted 10 lines

s/fail/fails/, s/relational/related/?

Quoted 1 line

You've posted this to the wrong mailing list, linux-mips; devicetree-discuss also seems hardly related.

WBR, Sergei

Hi Sergei,

Thank you for your remind.

author
#3 lore raw

PATCH v2 1/1 usb: omap2430: fix memleak in err case

In reply to Libo Chen

when omap_get_control_dev faild, we should release related platform_device

* Changelog from v1:
* fix spell: s/fail/fails/, s/relational/related/ , thank Sergei <[email protected]>

---
 drivers/usb/musb/omap2430.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/musb/omap2430.c +2 -1
index 3551f1a..b626f19 100644
@@ -549,7 +549,8 @@ static int omap2430_probe(struct platform_device *pdev)
 		glue->control_otghs = omap_get_control_dev();
 		if (IS_ERR(glue->control_otghs)) {
 			dev_vdbg(&pdev->dev, "Failed to get control device\n");
-			return -ENODEV;
+			ret = -ENODEV;
+			goto err2;
 		}
 	} else {
 		glue->control_otghs = ERR_PTR(-ENODEV);
Signature · 1 line
1.7.1
author
#4 lore raw

ping...

Quoted 26 lines · Libo Chen

when omap_get_control_dev faild, we should release related platform_device

* Changelog from v1:
* fix spell: s/fail/fails/, s/relational/related/ , thank Sergei <[email protected]>

---
 drivers/usb/musb/omap2430.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/musb/omap2430.c +2 -1
index 3551f1a..b626f19 100644
@@ -549,7 +549,8 @@ static int omap2430_probe(struct platform_device *pdev)
 		glue->control_otghs = omap_get_control_dev();
 		if (IS_ERR(glue->control_otghs)) {
 			dev_vdbg(&pdev->dev, "Failed to get control device\n");
-			return -ENODEV;
+			ret = -ENODEV;
+			goto err2;
 		}
 	} else {
 		glue->control_otghs = ERR_PTR(-ENODEV);
#5 lore raw

No go.

Check the 4b7e450fb5cefb5865c77999a675330206ab3b8a And update you tree, please.

--
With Best Regards,
Andy Shevchenko

author
#6 lore raw
Quoted 10 lines · Andy Shevchenko

No go.

Check the 4b7e450fb5cefb5865c77999a675330206ab3b8a And update you tree, please.

--
With Best Regards,
Andy Shevchenko

It had been changed :(

Thanks,

Libo

#7 lore raw
In reply to Libo Chen

Hello.

Quoted 4 lines · Libo Chen

when omap_get_control_dev faild, we should release related platform_device

* Changelog from v1:
* fix spell: s/fail/fails/, s/relational/related/ , thank Sergei <[email protected]>

It seems you've actually replaced "fail" with "faild", not "fails".

Quoted 4 lines
---
  drivers/usb/musb/omap2430.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

WBR, Sergei

author
#8 lore raw
Quoted 10 lines · Sergei Shtylyov

Hello.

Quoted 4 lines · Libo Chen

when omap_get_control_dev faild, we should release related platform_device

* Changelog from v1:
* fix spell: s/fail/fails/, s/relational/related/ , thank Sergei <[email protected]>

It seems you've actually replaced "fail" with "faild", not "fails".

sorry for my weak spell.

thanks again,

Libo

Quoted 10 lines
Quoted 5 lines
---
  drivers/usb/musb/omap2430.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

WBR, Sergei