* [PATCH] drivers: net: davinci_cpdma: drop devm_kfree of devm_kzalloc'd data
@ 2014-08-10 19:58 Himangi Saraogi
2014-08-10 20:26 ` Daniel Mack
0 siblings, 1 reply; 2+ messages in thread
From: Himangi Saraogi @ 2014-08-10 19:58 UTC (permalink / raw)
To: David S. Miller, Olof Johansson, Daniel Mack, Dan Carpenter,
Felipe Balbi, netdev, linux-kernel
Cc: Julia Lawall
devm_kfree should not have to be explicitly used.
The Coccinelle semantic patch that fixes this problem is as follows:
// <smpl>
@@
expression x,d;
@@
x = devm_kzalloc(...)
...
?-devm_kfree(d,x);
// </smpl>
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
drivers/net/ethernet/ti/davinci_cpdma.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 4a000f6..af673f5 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -512,7 +512,6 @@ struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num,
spin_lock_irqsave(&ctlr->lock, flags);
if (ctlr->channels[chan_num]) {
spin_unlock_irqrestore(&ctlr->lock, flags);
- devm_kfree(ctlr->dev, chan);
return ERR_PTR(-EBUSY);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers: net: davinci_cpdma: drop devm_kfree of devm_kzalloc'd data
2014-08-10 19:58 [PATCH] drivers: net: davinci_cpdma: drop devm_kfree of devm_kzalloc'd data Himangi Saraogi
@ 2014-08-10 20:26 ` Daniel Mack
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Mack @ 2014-08-10 20:26 UTC (permalink / raw)
To: Himangi Saraogi, David S. Miller, Olof Johansson, Dan Carpenter,
Felipe Balbi, netdev, linux-kernel
Cc: Julia Lawall
On 08/10/2014 09:58 PM, Himangi Saraogi wrote:
> devm_kfree should not have to be explicitly used.
>
> The Coccinelle semantic patch that fixes this problem is as follows:
>
> // <smpl>
> @@
> expression x,d;
> @@
>
> x = devm_kzalloc(...)
> ...
> ?-devm_kfree(d,x);
> // </smpl>
>
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Daniel Mack <zonque@gmail.com>
However, you need to resend this patch after 3.17-rc1 has been released
and the net-next branch was opened again.
Thanks,
Daniel
> ---
> drivers/net/ethernet/ti/davinci_cpdma.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
> index 4a000f6..af673f5 100644
> --- a/drivers/net/ethernet/ti/davinci_cpdma.c
> +++ b/drivers/net/ethernet/ti/davinci_cpdma.c
> @@ -512,7 +512,6 @@ struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num,
> spin_lock_irqsave(&ctlr->lock, flags);
> if (ctlr->channels[chan_num]) {
> spin_unlock_irqrestore(&ctlr->lock, flags);
> - devm_kfree(ctlr->dev, chan);
> return ERR_PTR(-EBUSY);
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-10 20:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-10 19:58 [PATCH] drivers: net: davinci_cpdma: drop devm_kfree of devm_kzalloc'd data Himangi Saraogi
2014-08-10 20:26 ` Daniel Mack
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).