diff mbox

net: ethernet: ti: davinci_cpdma: free memory while channel destroy

Message ID 1478610965-25288-1-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit b602e491a518439abd98a25ccded85e1347b9a14
Headers show

Commit Message

Ivan Khoronzhuk Nov. 8, 2016, 1:16 p.m. UTC
While create/destroy channel operation memory is not freed. It was
supposed that memory is freed while driver remove. But a channel
can be created and destroyed many times while changing number of
channels with ethtool.

Based on net-next/master

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

---
 drivers/net/ethernet/ti/davinci_cpdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.9.1

Comments

David Miller Nov. 13, 2016, 2:07 a.m. UTC | #1
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

Date: Tue,  8 Nov 2016 15:16:05 +0200

> While create/destroy channel operation memory is not freed. It was

> supposed that memory is freed while driver remove. But a channel

> can be created and destroyed many times while changing number of

> channels with ethtool.

> 

> Based on net-next/master

> 

> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>


Applied.
diff mbox

Patch

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 05afc05..07fc92d 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -586,7 +586,7 @@  int cpdma_chan_destroy(struct cpdma_chan *chan)
 		cpdma_chan_stop(chan);
 	ctlr->channels[chan->chan_num] = NULL;
 	ctlr->chan_num--;
-
+	devm_kfree(ctlr->dev, chan);
 	cpdma_chan_split_pool(ctlr);
 
 	spin_unlock_irqrestore(&ctlr->lock, flags);