[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <56CD2A8F.2060709@synopsys.com>
Date: Tue, 23 Feb 2016 19:59:11 -0800
From: John Youn <John.Youn@...opsys.com>
To: Amitoj Kaur Chawla <amitoj1606@...il.com>,
"John.Youn@...opsys.com" <John.Youn@...opsys.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Felipe Balbi <balbi@...nel.org>
CC: "julia.lawall@...6.fr" <julia.lawall@...6.fr>
Subject: Re: [PATCH] usb: dwc2: Use kmem_cache_free()
On 2/22/2016 12:11 AM, Amitoj Kaur Chawla wrote:
> Here, free memory is allocated using kmem_cache_zalloc. So, use
> kmem_cache_free instead of kfree.
>
> This is done using Coccinelle and semantic patch used
> is as follows:
>
> //<smpl>
> @@
> expression x,E,c;
> @@
> x =
> \(kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache_alloc_node\)(c,...)
> ... when != x = E
> when != &x
> ?-kfree(x)
> +kmem_cache_free(c,x)
> //</smpl>
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@...il.com>
> ---
> drivers/usb/dwc2/hcd_ddma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c
> index 36606fc..d6ebd16 100644
> --- a/drivers/usb/dwc2/hcd_ddma.c
> +++ b/drivers/usb/dwc2/hcd_ddma.c
> @@ -111,7 +111,7 @@ static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
> dma_unmap_single(hsotg->dev, qh->desc_list_dma,
> qh->desc_list_sz,
> DMA_FROM_DEVICE);
> - kfree(qh->desc_list);
> + kmem_cache_free(desc_cache, qh->desc_list);
> qh->desc_list = NULL;
> return -ENOMEM;
> }
>
Acked-by: John Youn <johnyoun@...opsys.com>
John
Powered by blists - more mailing lists