linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Xidong Wang <wangxidong_97@163.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] dmaengine:jz4740:fix memory leak
Date: Wed, 4 Apr 2018 11:30:57 +0530	[thread overview]
Message-ID: <20180404060056.GG15443@localhost> (raw)
In-Reply-To: <1522812118-25763-1-git-send-email-wangxidong_97@163.com>

On Wed, Apr 04, 2018 at 11:21:58AM +0800, Xidong Wang wrote:
> In function jz4740_dma_probe(), the memory allocated by
> clk_get() is not released on the error path that ret, which holds
> the return value of dma_async_device_register(), is not NULL.
> This will result in a memory leak bug.

I dont think we cna cal it mem leak, it seems your ref counting of clock
resource is imbalance as you dont free up which eventually would lead to mem
leak. Also dabove description needs a bit of cleanup please

> 
> Signed-off-by: Xidong Wang <wangxidong_97@163.com>
> ---
>  drivers/dma/dma-jz4740.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c
> index afd5e10..082c158 100644
> --- a/drivers/dma/dma-jz4740.c
> +++ b/drivers/dma/dma-jz4740.c
> @@ -570,6 +570,7 @@ static int jz4740_dma_probe(struct platform_device *pdev)
>  	dma_async_device_unregister(dd);
>  err_clk:
>  	clk_disable_unprepare(dmadev->clk);
> +	clk_put(dmadev->clk);
>  	return ret;
>  }
>  
> -- 
> 2.7.4
> 
> 

-- 
~Vinod

  reply	other threads:[~2018-04-04  5:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04  3:21 [PATCH 1/1] dmaengine:jz4740:fix memory leak Xidong Wang
2018-04-04  6:00 ` Vinod Koul [this message]
2018-04-04 12:45 ` Lars-Peter Clausen

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=20180404060056.GG15443@localhost \
    --to=vinod.koul@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangxidong_97@163.com \
    /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;
as well as URLs for NNTP newsgroup(s).