drivers: net: davinci_cpdma: drop devm_kfree of devm_kzalloc'd data
Subsystems (3)
PATCH 1/1 drivers: net: davinci_cpdma: drop devm_kfree of devm_kzalloc'd data
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 <[email protected]>
Acked-by Julia Lawall <[email protected]>
--- drivers/net/ethernet/ti/davinci_cpdma.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/ti/davinci_cpdma.c +0 -1
@@ -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 ); }
Signature · 1 line
1.9.1
Quoted 9 lines · Himangi Saraogi
devm_kfreeshould not have to be explicitly used.The Coccinelle semantic patch that fixes this problem is as follows:
// <smpl>
@@
expression x,d;
@@
Quoted 7 lines
x =
devm_kzalloc(...)
...
?-devm_kfree(d,x);
// </smpl>Signed-off-by Himangi Saraogi <[email protected]>Acked-by Julia Lawall <[email protected]>
Acked-by Daniel Mack <[email protected]>
However, you need to resend this patch after 3.17-rc1 has been released and the net-next branch was opened again.
Thanks,
Daniel
Quoted 17 lines
--- drivers/net/ethernet/ti/davinci_cpdma.c | 1 - 1 file changed, 1 deletion(-)drivers/net/ethernet/ti/davinci_cpdma.c +0
-1@@ -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 ); }