diff options
author | Libo Chen <libo.chen@huawei.com> | 2013-05-09 02:08:33 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2013-05-09 13:56:40 -0400 |
commit | abab8761d095e0805879df48a8ba6ea7f8b31c5e (patch) | |
tree | c1a82629529996480a7117763eef4cad0f72e537 /drivers/usb/host/ehci-tilegx.c | |
parent | 4833d7f0a86fd9a44f98bedf0c639e1da070d3a0 (diff) |
usb: tilegx: fix memleak when create hcd fail
When usb_create_hcd fail, we should call gxio_usb_host_destroy
Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> [extended to EHCI]
Diffstat (limited to 'drivers/usb/host/ehci-tilegx.c')
-rw-r--r-- | drivers/usb/host/ehci-tilegx.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-tilegx.c b/drivers/usb/host/ehci-tilegx.c index 1d215cdb9dea..b083a350eea3 100644 --- a/drivers/usb/host/ehci-tilegx.c +++ b/drivers/usb/host/ehci-tilegx.c | |||
@@ -118,8 +118,10 @@ static int ehci_hcd_tilegx_drv_probe(struct platform_device *pdev) | |||
118 | 118 | ||
119 | hcd = usb_create_hcd(&ehci_tilegx_hc_driver, &pdev->dev, | 119 | hcd = usb_create_hcd(&ehci_tilegx_hc_driver, &pdev->dev, |
120 | dev_name(&pdev->dev)); | 120 | dev_name(&pdev->dev)); |
121 | if (!hcd) | 121 | if (!hcd) { |
122 | return -ENOMEM; | 122 | ret = -ENOMEM; |
123 | goto err_hcd; | ||
124 | } | ||
123 | 125 | ||
124 | /* | 126 | /* |
125 | * We don't use rsrc_start to map in our registers, but seems like | 127 | * We don't use rsrc_start to map in our registers, but seems like |
@@ -176,6 +178,7 @@ err_have_irq: | |||
176 | err_no_irq: | 178 | err_no_irq: |
177 | tilegx_stop_ehc(); | 179 | tilegx_stop_ehc(); |
178 | usb_put_hcd(hcd); | 180 | usb_put_hcd(hcd); |
181 | err_hcd: | ||
179 | gxio_usb_host_destroy(&pdata->usb_ctx); | 182 | gxio_usb_host_destroy(&pdata->usb_ctx); |
180 | return ret; | 183 | return ret; |
181 | } | 184 | } |