All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Navid Emamdoost <navid.emamdoost@gmail.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Vinod Koul <vkoul@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	<dmaengine@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <emamd001@umn.edu>, <wu000273@umn.edu>, <kjlu@umn.edu>,
	<smccaman@umn.edu>
Subject: Re: [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure
Date: Thu, 4 Jun 2020 18:43:23 +0100	[thread overview]
Message-ID: <eb3e65fa-0ab6-a448-e5c8-e95561b6e4e9@nvidia.com> (raw)
In-Reply-To: <20200603183845.91054-1-navid.emamdoost@gmail.com>


On 03/06/2020 19:38, Navid Emamdoost wrote:
> Calling pm_runtime_get_sync increments the counter even in case of
> failure, causing incorrect ref count. Call pm_runtime_put if
> pm_runtime_get_sync fails.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
>  drivers/dma/tegra210-adma.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
> index c4ce5dfb149b..87f2a1bed3aa 100644
> --- a/drivers/dma/tegra210-adma.c
> +++ b/drivers/dma/tegra210-adma.c
> @@ -869,8 +869,10 @@ static int tegra_adma_probe(struct platform_device *pdev)
>  	pm_runtime_enable(&pdev->dev);
>  
>  	ret = pm_runtime_get_sync(&pdev->dev);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		pm_runtime_put_sync(&pdev->dev);
>  		goto rpm_disable;
> +	}

I would prefer it if you did not add the pm_runtime_put_sync() call here
because there is already one in the error path that can be used.

Jon

-- 
nvpublic

WARNING: multiple messages have this Message-ID (diff)
From: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Navid Emamdoost
	<navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Laxman Dewangan
	<ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Dan Williams
	<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Vinod Koul <vkoul-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: emamd001-OJFnDUYgAso@public.gmane.org,
	wu000273-OJFnDUYgAso@public.gmane.org,
	kjlu-OJFnDUYgAso@public.gmane.org,
	smccaman-OJFnDUYgAso@public.gmane.org
Subject: Re: [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure
Date: Thu, 4 Jun 2020 18:43:23 +0100	[thread overview]
Message-ID: <eb3e65fa-0ab6-a448-e5c8-e95561b6e4e9@nvidia.com> (raw)
In-Reply-To: <20200603183845.91054-1-navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>


On 03/06/2020 19:38, Navid Emamdoost wrote:
> Calling pm_runtime_get_sync increments the counter even in case of
> failure, causing incorrect ref count. Call pm_runtime_put if
> pm_runtime_get_sync fails.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/dma/tegra210-adma.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
> index c4ce5dfb149b..87f2a1bed3aa 100644
> --- a/drivers/dma/tegra210-adma.c
> +++ b/drivers/dma/tegra210-adma.c
> @@ -869,8 +869,10 @@ static int tegra_adma_probe(struct platform_device *pdev)
>  	pm_runtime_enable(&pdev->dev);
>  
>  	ret = pm_runtime_get_sync(&pdev->dev);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		pm_runtime_put_sync(&pdev->dev);
>  		goto rpm_disable;
> +	}

I would prefer it if you did not add the pm_runtime_put_sync() call here
because there is already one in the error path that can be used.

Jon

-- 
nvpublic

  reply	other threads:[~2020-06-04 17:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 18:38 [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure Navid Emamdoost
2020-06-03 18:38 ` Navid Emamdoost
2020-06-04 17:43 ` Jon Hunter [this message]
2020-06-04 17:43   ` Jon Hunter
2020-06-03 18:41 Navid Emamdoost
2020-06-03 18:41 ` Navid Emamdoost
2020-06-04 17:45 ` Jon Hunter
2020-06-04 17:45   ` Jon Hunter
2020-06-04 17:48   ` Navid Emamdoost
2020-06-04 17:48     ` Navid Emamdoost

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=eb3e65fa-0ab6-a448-e5c8-e95561b6e4e9@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=emamd001@umn.edu \
    --cc=kjlu@umn.edu \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=navid.emamdoost@gmail.com \
    --cc=smccaman@umn.edu \
    --cc=thierry.reding@gmail.com \
    --cc=vkoul@kernel.org \
    --cc=wu000273@umn.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.