Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753399AbcKHXWO (ORCPT ); Tue, 8 Nov 2016 18:22:14 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:47337 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751062AbcKHXWL (ORCPT ); Tue, 8 Nov 2016 18:22:11 -0500 Subject: Re: [PATCH] net: ethernet: ti: davinci_cpdma: free memory while channel destroy To: Ivan Khoronzhuk , , References: <1478610965-25288-1-git-send-email-ivan.khoronzhuk@linaro.org> CC: , From: Grygorii Strashko Message-ID: <366a66b8-33f4-2ad7-4ac4-957d25348718@ti.com> Date: Tue, 8 Nov 2016 17:22:09 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1478610965-25288-1-git-send-email-ivan.khoronzhuk@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [128.247.83.173] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1076 Lines: 39 On 11/08/2016 07:16 AM, Ivan Khoronzhuk wrote: > 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 Reviewed-by: Grygorii Strashko > --- > drivers/net/ethernet/ti/davinci_cpdma.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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); > -- regards, -grygorii