lkml.org 
[lkml]   [2013]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RESEND 4/4] usb: tilegx: fix memleak when create hcd fail
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>



\
 
 \ /
  Last update: 2013-05-09 22:41    [W:0.075 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site