public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang7@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	dmaengine@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed
Date: Tue, 26 Jul 2022 18:21:02 +0530	[thread overview]
Message-ID: <Yt/jNiMwWK+PgAD1@matsya> (raw)
In-Reply-To: <20220721204054.323602-1-u.kleine-koenig@pengutronix.de>

On 21-07-22, 22:40, Uwe Kleine-König wrote:
> It's not allowed to quit remove early without cleaning up completely.
> Otherwise this results in resource leaks that probably yield graver
> problems later. Here for example some tasklets might survive the lifetime
> of the sprd-dma device and access sdev which is freed after .remove()
> returns.
> 
> As none of the device freeing requires an active device, just ignore the
> return value of pm_runtime_get_sync().

Applied, thanks

> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/dma/sprd-dma.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index 2138b80435ab..474d3ba8ec9f 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -1237,11 +1237,8 @@ static int sprd_dma_remove(struct platform_device *pdev)
>  {
>  	struct sprd_dma_dev *sdev = platform_get_drvdata(pdev);
>  	struct sprd_dma_chn *c, *cn;
> -	int ret;
>  
> -	ret = pm_runtime_get_sync(&pdev->dev);
> -	if (ret < 0)
> -		return ret;
> +	pm_runtime_get_sync(&pdev->dev);
>  
>  	/* explicitly free the irq */
>  	if (sdev->irq > 0)
> 
> base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
> -- 
> 2.36.1

-- 
~Vinod

      parent reply	other threads:[~2022-07-26 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 20:40 [PATCH] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed Uwe Kleine-König
2022-07-22  1:36 ` Baolin Wang
2022-07-22  8:21 ` Uwe Kleine-König
2022-07-26 12:51 ` Vinod Koul [this message]

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=Yt/jNiMwWK+PgAD1@matsya \
    --to=vkoul@kernel.org \
    --cc=baolin.wang7@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=orsonzhai@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=zhang.lyra@gmail.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