From: Libo Chen <libo.chen@huawei.com>
To: <stern@rowland.harvard.edu>, <grant.likely@linaro.org>,
<rob.herring@calxeda.com>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<akpm@linux-foundation.org>, <lizefan@huawei.com>,
Libo Chen <chenlibo.3@gmail.com>,
Libo Chen <libo.chen@huawei.com>
Subject: [PATCH 4/4] usb: tilegx: fix memleak when create hcd fail
Date: Thu, 9 May 2013 12:58:11 +0800 [thread overview]
Message-ID: <1368075491-38728-5-git-send-email-libo.chen@huawei.com> (raw)
In-Reply-To: <1368075491-38728-1-git-send-email-libo.chen@huawei.com>
From: Libo Chen <chenlibo.3@gmail.com>
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
next prev parent reply other threads:[~2013-05-09 5:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-09 4:58 [PATCH 0/4] usb: fix four memleak Libo Chen
2013-05-09 4:58 ` [PATCH 1/4] usb: ehci-s5p: fix memleak when fallback to pdata Libo Chen
2013-05-09 4:58 ` [PATCH 2/4] usb: isp1760-if: fix memleak when platform_get_resource fail Libo Chen
2013-05-09 4:58 ` [PATCH 3/4] usb: ohci: fix goto wrong tag in err case Libo Chen
2013-05-17 0:34 ` Greg KH
2013-05-09 4:58 ` Libo Chen [this message]
2013-05-17 0:34 ` [PATCH 4/4] usb: tilegx: fix memleak when create hcd fail Greg KH
2013-05-17 4:31 ` Libo Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1368075491-38728-5-git-send-email-libo.chen@huawei.com \
--to=libo.chen@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=chenlibo.3@gmail.com \
--cc=grant.likely@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=rob.herring@calxeda.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome