linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang7@gmail.com>
To: Dongliang Mu <mudongliangabcd@gmail.com>
Cc: Vinod Koul <vkoul@kernel.org>, Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Baolin Wang <baolin.wang@spreadtrum.com>,
	dmaengine@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dmaengine: sprd: move pm_runtime_disable to err_rpm
Date: Tue, 7 Dec 2021 09:39:24 +0800	[thread overview]
Message-ID: <CADBw62pSJ=rHjwTocxeeuCgtadLKqz-U7gAQek5Eo_bBQSzBzQ@mail.gmail.com> (raw)
In-Reply-To: <20211206113437.2820889-1-mudongliangabcd@gmail.com>

Hi Dongliang,

On Mon, Dec 6, 2021 at 7:34 PM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>
> When pm_runtime_get_sync fails, it forgets to invoke pm_runtime_disable
> in the label err_rpm.
>
> Fix this by moving pm_runtime_disable to label err_rpm.
>
> Fixes: 9b3b8171f7f4 ("dmaengine: sprd: Add Spreadtrum DMA driver")
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---

Thanks for your patch, but looking at the code in detail, I think we
also should decrease the rpm counter when failing to call the
pm_runtime_get_sync().

--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -1210,7 +1210,7 @@ static int sprd_dma_probe(struct platform_device *pdev)
        ret = dma_async_device_register(&sdev->dma_dev);
        if (ret < 0) {
                dev_err(&pdev->dev, "register dma device failed:%d\n", ret);
-               goto err_register;
+               goto err_rpm;
        }

        sprd_dma_info.dma_cap = sdev->dma_dev.cap_mask;
@@ -1224,10 +1224,9 @@ static int sprd_dma_probe(struct platform_device *pdev)

 err_of_register:
        dma_async_device_unregister(&sdev->dma_dev);
-err_register:
+err_rpm:
        pm_runtime_put_noidle(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
-err_rpm:
        sprd_dma_disable(sdev);
        return ret;
 }

-- 
Baolin Wang

  reply	other threads:[~2021-12-07  1:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 11:34 [PATCH] dmaengine: sprd: move pm_runtime_disable to err_rpm Dongliang Mu
2021-12-07  1:39 ` Baolin Wang [this message]
2021-12-07  2:06   ` Dongliang Mu

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='CADBw62pSJ=rHjwTocxeeuCgtadLKqz-U7gAQek5Eo_bBQSzBzQ@mail.gmail.com' \
    --to=baolin.wang7@gmail.com \
    --cc=baolin.wang@spreadtrum.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mudongliangabcd@gmail.com \
    --cc=orsonzhai@gmail.com \
    --cc=vkoul@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).