dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang7@gmail.com>
To: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: kjlu@umn.edu, Dan Williams <dan.j.williams@intel.com>,
	Vinod Koul <vkoul@kernel.org>, Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	dmaengine@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dmaengine: sprd: Fix runtime PM imbalance on error
Date: Fri, 22 May 2020 20:33:50 +0800	[thread overview]
Message-ID: <CADBw62oUW7-f05nHX1-cQM+tqyAVVt-knihmiPvekU93L=bLjA@mail.gmail.com> (raw)
In-Reply-To: <20200522065243.19590-1-dinghao.liu@zju.edu.cn>

On Fri, May 22, 2020 at 2:53 PM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
>
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced.
>
> Also, call pm_runtime_disable() when pm_runtime_get_sync() returns
> an error code.

Good catch. Thanks.
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>

>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/dma/sprd-dma.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index 0ef5ca81ba4d..275d83768d0d 100644
> --- 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;
>  }
> --
> 2.17.1
>


-- 
Baolin Wang

      reply	other threads:[~2020-05-22 12:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  6:52 [PATCH] dmaengine: sprd: Fix runtime PM imbalance on error Dinghao Liu
2020-05-22 12:33 ` Baolin Wang [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='CADBw62oUW7-f05nHX1-cQM+tqyAVVt-knihmiPvekU93L=bLjA@mail.gmail.com' \
    --to=baolin.wang7@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=dinghao.liu@zju.edu.cn \
    --cc=dmaengine@vger.kernel.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --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).