All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 0/4] usb: fix four memleak
@ 2013-05-09  6:05 Libo Chen
  2013-05-09  6:05 ` [PATCH RESEND 1/4] usb: ehci-s5p: fix memleak when devm_usb_get_phy fail Libo Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Libo Chen @ 2013-05-09  6:05 UTC (permalink / raw)
  To: stern, grant.likely, rob.herring
  Cc: linux-usb, linux-kernel, akpm, lizefan, Libo Chen

change address from "Libo Chen <chenlibo.3@gmail.com>"  to "Libo Chen <libo.chen@huawei.com>"

fix four goto wrong tag, avoid memleak 

Libo Chen (4):
  usb: ehci-s5p: fix memleak when devm_usb_get_phy fail
  usb: isp1760-if: fix memleak when platform_get_resource fail
  usb: ohci: fix goto wrong tag in err case
  usb: tilegx: fix memleak when create hcd fail

 drivers/usb/host/ehci-s5p.c    |    1 +
 drivers/usb/host/isp1760-if.c  |    4 +++-
 drivers/usb/host/ohci-nxp.c    |   12 ++++++------
 drivers/usb/host/ohci-tilegx.c |    7 +++++--
 4 files changed, 15 insertions(+), 9 deletions(-)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH RESEND 1/4] usb: ehci-s5p: fix memleak when devm_usb_get_phy fail
  2013-05-09  6:05 [PATCH RESEND 0/4] usb: fix four memleak Libo Chen
@ 2013-05-09  6:05 ` Libo Chen
  2013-05-09 19:29   ` Alan Stern
  2013-05-09  6:05 ` [PATCH RESEND 2/4] usb: isp1760-if: fix memleak when platform_get_resource fail Libo Chen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Libo Chen @ 2013-05-09  6:05 UTC (permalink / raw)
  To: stern, grant.likely, rob.herring
  Cc: linux-usb, linux-kernel, akpm, lizefan, Libo Chen

When devm_usb_get_phy fail, we should free hcd

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/usb/host/ehci-s5p.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 6357752..3fbab58 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -107,6 +107,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 	if (IS_ERR(phy)) {
 		/* Fallback to pdata */
 		if (!pdata) {
+			usb_put_hcd(hcd);
 			dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
 			return -EPROBE_DEFER;
 		} else {
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH RESEND 2/4] usb: isp1760-if: fix memleak when platform_get_resource fail
  2013-05-09  6:05 [PATCH RESEND 0/4] usb: fix four memleak Libo Chen
  2013-05-09  6:05 ` [PATCH RESEND 1/4] usb: ehci-s5p: fix memleak when devm_usb_get_phy fail Libo Chen
@ 2013-05-09  6:05 ` Libo Chen
  2013-05-09  6:05 ` [PATCH RESEND 3/4] usb: ohci: fix goto wrong tag in err case Libo Chen
  2013-05-09  6:05 ` [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail Libo Chen
  3 siblings, 0 replies; 11+ messages in thread
From: Libo Chen @ 2013-05-09  6:05 UTC (permalink / raw)
  To: stern, grant.likely, rob.herring
  Cc: linux-usb, linux-kernel, akpm, lizefan, Libo Chen

When platform_get_resource fail, we should release_mem_region

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/usb/host/isp1760-if.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index bbb791b..a13709e 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -373,8 +373,10 @@ static int isp1760_plat_probe(struct platform_device *pdev)
 	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!irq_res) {
 		pr_warning("isp1760: IRQ resource not available\n");
-		return -ENODEV;
+		ret = -ENODEV;
+		goto cleanup;
 	}
+
 	irqflags |= irq_res->flags & IRQF_TRIGGER_MASK;
 
 	if (priv) {
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH RESEND 3/4] usb: ohci: fix goto wrong tag in err case
  2013-05-09  6:05 [PATCH RESEND 0/4] usb: fix four memleak Libo Chen
  2013-05-09  6:05 ` [PATCH RESEND 1/4] usb: ehci-s5p: fix memleak when devm_usb_get_phy fail Libo Chen
  2013-05-09  6:05 ` [PATCH RESEND 2/4] usb: isp1760-if: fix memleak when platform_get_resource fail Libo Chen
@ 2013-05-09  6:05 ` Libo Chen
  2013-05-09 19:27   ` Alan Stern
  2013-05-09  6:05 ` [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail Libo Chen
  3 siblings, 1 reply; 11+ messages in thread
From: Libo Chen @ 2013-05-09  6:05 UTC (permalink / raw)
  To: stern, grant.likely, rob.herring
  Cc: linux-usb, linux-kernel, akpm, lizefan, Libo Chen

fix goto wrong tag in usb_hcd_nxp_probe

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/usb/host/ohci-nxp.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index f4988fb..eb294a9 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -234,7 +234,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
 	if (usb_disabled()) {
 		dev_err(&pdev->dev, "USB is disabled\n");
 		ret = -ENODEV;
-		goto out;
+		goto out1;
 	}
 
 	/* Enable AHB slave USB clock, needed for further USB clock control */
@@ -265,13 +265,13 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
 	if (IS_ERR(usb_dev_clk)) {
 		dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
 		ret = PTR_ERR(usb_dev_clk);
-		goto out4;
+		goto out3;
 	}
 
 	ret = clk_enable(usb_dev_clk);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
-		goto out5;
+		goto out4;
 	}
 
 	/* Enable USB otg clocks */
@@ -279,7 +279,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
 	if (IS_ERR(usb_otg_clk)) {
 		dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
 		ret = PTR_ERR(usb_otg_clk);
-		goto out6;
+		goto out5;
 	}
 
 	__raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL);
@@ -287,7 +287,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
 	ret = clk_enable(usb_otg_clk);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
-		goto out7;
+		goto out6;
 	}
 
 	isp1301_configure();
@@ -296,7 +296,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
 	if (!hcd) {
 		dev_err(&pdev->dev, "Failed to allocate HC buffer\n");
 		ret = -ENOMEM;
-		goto out8;
+		goto out7;
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail
  2013-05-09  6:05 [PATCH RESEND 0/4] usb: fix four memleak Libo Chen
                   ` (2 preceding siblings ...)
  2013-05-09  6:05 ` [PATCH RESEND 3/4] usb: ohci: fix goto wrong tag in err case Libo Chen
@ 2013-05-09  6:05 ` Libo Chen
  2013-05-09 18:02   ` Chris Metcalf
  2013-05-09 19:29   ` Alan Stern
  3 siblings, 2 replies; 11+ messages in thread
From: Libo Chen @ 2013-05-09  6:05 UTC (permalink / raw)
  To: stern, grant.likely, rob.herring
  Cc: linux-usb, linux-kernel, akpm, lizefan, Libo Chen

When usb_create_hcd fail, we should call gxio_usb_host_destroy

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/usb/host/ohci-tilegx.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-tilegx.c b/drivers/usb/host/ohci-tilegx.c
index 1ae7b28..5888fc4 100644
--- a/drivers/usb/host/ohci-tilegx.c
+++ b/drivers/usb/host/ohci-tilegx.c
@@ -112,8 +112,10 @@ static int ohci_hcd_tilegx_drv_probe(struct platform_device *pdev)
 
 	hcd = usb_create_hcd(&ohci_tilegx_hc_driver, &pdev->dev,
 			     dev_name(&pdev->dev));
-	if (!hcd)
-		return -ENOMEM;
+	if (!hcd){
+		ret = -ENOMEM;
+		goto err_hcd;
+	}
 
 	/*
 	 * We don't use rsrc_start to map in our registers, but seems like
@@ -165,6 +167,7 @@ err_have_irq:
 err_no_irq:
 	tilegx_stop_ohc();
 	usb_put_hcd(hcd);
+err_hcd:
 	gxio_usb_host_destroy(&pdata->usb_ctx);
 	return ret;
 }
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail
  2013-05-09  6:05 ` [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail Libo Chen
@ 2013-05-09 18:02   ` Chris Metcalf
  2013-05-10  1:09     ` Libo Chen
  2013-05-09 19:29   ` Alan Stern
  1 sibling, 1 reply; 11+ messages in thread
From: Chris Metcalf @ 2013-05-09 18:02 UTC (permalink / raw)
  To: Libo Chen
  Cc: stern, grant.likely, rob.herring, linux-usb, linux-kernel, akpm, lizefan

On 5/9/2013 2:08 AM, Libo Chen wrote:
> When usb_create_hcd fail, we should call gxio_usb_host_destroy
>
> Signed-off-by: Libo Chen <libo.chen@huawei.com>
> ---
>  drivers/usb/host/ohci-tilegx.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)

Thanks; taken into the tile tree.  I also made the same change to ehci-tilegx.c.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND 3/4] usb: ohci: fix goto wrong tag in err case
  2013-05-09  6:05 ` [PATCH RESEND 3/4] usb: ohci: fix goto wrong tag in err case Libo Chen
@ 2013-05-09 19:27   ` Alan Stern
  0 siblings, 0 replies; 11+ messages in thread
From: Alan Stern @ 2013-05-09 19:27 UTC (permalink / raw)
  To: Libo Chen
  Cc: grant.likely, rob.herring, linux-usb, linux-kernel, akpm, lizefan

On Thu, 9 May 2013, Libo Chen wrote:

> fix goto wrong tag in usb_hcd_nxp_probe
> 
> Signed-off-by: Libo Chen <libo.chen@huawei.com>
> ---
>  drivers/usb/host/ohci-nxp.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index f4988fb..eb294a9 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -234,7 +234,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
>  	if (usb_disabled()) {
>  		dev_err(&pdev->dev, "USB is disabled\n");
>  		ret = -ENODEV;
> -		goto out;
> +		goto out1;
>  	}

Instead of renumbering all these statement labels, it would be better 
to replace them with names that have a real meaning.  That would 
simplify future fixes.

Can you submit a patch to do that instead?

Alan Stern


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND 1/4] usb: ehci-s5p: fix memleak when devm_usb_get_phy fail
  2013-05-09  6:05 ` [PATCH RESEND 1/4] usb: ehci-s5p: fix memleak when devm_usb_get_phy fail Libo Chen
@ 2013-05-09 19:29   ` Alan Stern
  0 siblings, 0 replies; 11+ messages in thread
From: Alan Stern @ 2013-05-09 19:29 UTC (permalink / raw)
  To: Libo Chen
  Cc: grant.likely, rob.herring, linux-usb, linux-kernel, akpm, lizefan

On Thu, 9 May 2013, Libo Chen wrote:

> When devm_usb_get_phy fail, we should free hcd
> 
> Signed-off-by: Libo Chen <libo.chen@huawei.com>
> ---
>  drivers/usb/host/ehci-s5p.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
> index 6357752..3fbab58 100644
> --- a/drivers/usb/host/ehci-s5p.c
> +++ b/drivers/usb/host/ehci-s5p.c
> @@ -107,6 +107,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
>  	if (IS_ERR(phy)) {
>  		/* Fallback to pdata */
>  		if (!pdata) {
> +			usb_put_hcd(hcd);
>  			dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
>  			return -EPROBE_DEFER;
>  		} else {

Acked-by: Alan Stern <stern@rowland.harvard.edu>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail
  2013-05-09  6:05 ` [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail Libo Chen
  2013-05-09 18:02   ` Chris Metcalf
@ 2013-05-09 19:29   ` Alan Stern
  1 sibling, 0 replies; 11+ messages in thread
From: Alan Stern @ 2013-05-09 19:29 UTC (permalink / raw)
  To: Libo Chen
  Cc: grant.likely, rob.herring, linux-usb, linux-kernel, akpm, lizefan

On Thu, 9 May 2013, Libo Chen wrote:

> When usb_create_hcd fail, we should call gxio_usb_host_destroy
> 
> Signed-off-by: Libo Chen <libo.chen@huawei.com>
> ---
>  drivers/usb/host/ohci-tilegx.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-tilegx.c b/drivers/usb/host/ohci-tilegx.c
> index 1ae7b28..5888fc4 100644
> --- a/drivers/usb/host/ohci-tilegx.c
> +++ b/drivers/usb/host/ohci-tilegx.c
> @@ -112,8 +112,10 @@ static int ohci_hcd_tilegx_drv_probe(struct platform_device *pdev)
>  
>  	hcd = usb_create_hcd(&ohci_tilegx_hc_driver, &pdev->dev,
>  			     dev_name(&pdev->dev));
> -	if (!hcd)
> -		return -ENOMEM;
> +	if (!hcd){
> +		ret = -ENOMEM;
> +		goto err_hcd;
> +	}
>  
>  	/*
>  	 * We don't use rsrc_start to map in our registers, but seems like
> @@ -165,6 +167,7 @@ err_have_irq:
>  err_no_irq:
>  	tilegx_stop_ohc();
>  	usb_put_hcd(hcd);
> +err_hcd:
>  	gxio_usb_host_destroy(&pdata->usb_ctx);
>  	return ret;
>  }

Acked-by: Alan Stern <stern@rowland.harvard.edu>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail
  2013-05-09 18:02   ` Chris Metcalf
@ 2013-05-10  1:09     ` Libo Chen
  2013-05-10  1:50       ` Libo Chen
  0 siblings, 1 reply; 11+ messages in thread
From: Libo Chen @ 2013-05-10  1:09 UTC (permalink / raw)
  To: Chris Metcalf
  Cc: Libo Chen, stern, grant.likely, rob.herring, linux-usb,
	linux-kernel, akpm, lizefan

On 2013/5/10 2:02, Chris Metcalf wrote:
> On 5/9/2013 2:08 AM, Libo Chen wrote:
>> When usb_create_hcd fail, we should call gxio_usb_host_destroy
>>
>> Signed-off-by: Libo Chen <libo.chen@huawei.com>
>> ---
>>  drivers/usb/host/ohci-tilegx.c |    7 +++++--
>>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> Thanks; taken into the tile tree.  I also made the same change to ehci-tilegx.c.
> 

Hi Chris,

Thanks reply, May be I miss. Please ignore this patch.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail
  2013-05-10  1:09     ` Libo Chen
@ 2013-05-10  1:50       ` Libo Chen
  0 siblings, 0 replies; 11+ messages in thread
From: Libo Chen @ 2013-05-10  1:50 UTC (permalink / raw)
  To: Chris Metcalf
  Cc: Libo Chen, stern, grant.likely, rob.herring, linux-usb,
	linux-kernel, akpm, lizefan

On 2013/5/10 9:09, Libo Chen wrote:
> On 2013/5/10 2:02, Chris Metcalf wrote:
>> On 5/9/2013 2:08 AM, Libo Chen wrote:
>>> When usb_create_hcd fail, we should call gxio_usb_host_destroy
>>>
>>> Signed-off-by: Libo Chen <libo.chen@huawei.com>
>>> ---
>>>  drivers/usb/host/ohci-tilegx.c |    7 +++++--
>>>  1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> Thanks; taken into the tile tree.  I also made the same change to ehci-tilegx.c.
>>
> 
> Hi Chris,
> 
> Thanks reply, May be I miss. Please ignore this patch.


 Sorry, this patch is ok, no problem.

> 
> 
> 
> .
> 



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-05-10  1:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-09  6:05 [PATCH RESEND 0/4] usb: fix four memleak Libo Chen
2013-05-09  6:05 ` [PATCH RESEND 1/4] usb: ehci-s5p: fix memleak when devm_usb_get_phy fail Libo Chen
2013-05-09 19:29   ` Alan Stern
2013-05-09  6:05 ` [PATCH RESEND 2/4] usb: isp1760-if: fix memleak when platform_get_resource fail Libo Chen
2013-05-09  6:05 ` [PATCH RESEND 3/4] usb: ohci: fix goto wrong tag in err case Libo Chen
2013-05-09 19:27   ` Alan Stern
2013-05-09  6:05 ` [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail Libo Chen
2013-05-09 18:02   ` Chris Metcalf
2013-05-10  1:09     ` Libo Chen
2013-05-10  1:50       ` Libo Chen
2013-05-09 19:29   ` Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.