public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Youn <John.Youn@synopsys.com>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>,
	"John.Youn@synopsys.com" <John.Youn@synopsys.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Felipe Balbi <balbi@kernel.org>
Cc: "julia.lawall@lip6.fr" <julia.lawall@lip6.fr>
Subject: Re: [PATCH] usb: dwc2: Use kmem_cache_free()
Date: Tue, 23 Feb 2016 19:59:11 -0800	[thread overview]
Message-ID: <56CD2A8F.2060709@synopsys.com> (raw)
In-Reply-To: <20160222081032.GA9818@amitoj-Inspiron-3542>

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@gmail.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@synopsys.com>


John

      reply	other threads:[~2016-02-24  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22  8:10 [PATCH] usb: dwc2: Use kmem_cache_free() Amitoj Kaur Chawla
2016-02-24  3:59 ` John Youn [this message]

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=56CD2A8F.2060709@synopsys.com \
    --to=john.youn@synopsys.com \
    --cc=amitoj1606@gmail.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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