* [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure
@ 2020-06-03 18:38 Navid Emamdoost
2020-06-04 17:43 ` Jon Hunter
0 siblings, 1 reply; 5+ messages in thread
From: Navid Emamdoost @ 2020-06-03 18:38 UTC (permalink / raw)
To: Laxman Dewangan, Jon Hunter, Dan Williams, Vinod Koul,
Thierry Reding, dmaengine, linux-tegra, linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost
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;
+ }
ret = tegra_adma_init(tdma);
if (ret)
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure
2020-06-03 18:38 [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure Navid Emamdoost
@ 2020-06-04 17:43 ` Jon Hunter
0 siblings, 0 replies; 5+ messages in thread
From: Jon Hunter @ 2020-06-04 17:43 UTC (permalink / raw)
To: Navid Emamdoost, Laxman Dewangan, Dan Williams, Vinod Koul,
Thierry Reding, dmaengine, linux-tegra, linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure
2020-06-04 17:45 ` Jon Hunter
@ 2020-06-04 17:48 ` Navid Emamdoost
0 siblings, 0 replies; 5+ messages in thread
From: Navid Emamdoost @ 2020-06-04 17:48 UTC (permalink / raw)
To: Jon Hunter
Cc: Laxman Dewangan, Vinod Koul, Dan Williams, Thierry Reding,
dmaengine, linux-tegra, LKML, Navid Emamdoost, Qiushi Wu,
Kangjie Lu, Stephen McCamant
On Thu, Jun 4, 2020 at 12:45 PM Jon Hunter <jonathanh@nvidia.com> wrote:
>
>
> On 03/06/2020 19:41, 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 | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
> > index c4ce5dfb149b..e8c749cd3fe8 100644
> > --- a/drivers/dma/tegra210-adma.c
> > +++ b/drivers/dma/tegra210-adma.c
> > @@ -659,6 +659,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc)
> > ret = pm_runtime_get_sync(tdc2dev(tdc));
> > if (ret < 0) {
> > free_irq(tdc->irq, tdc);
> > + pm_runtime_put(tdc2dev(tdc));
> > return ret;
> > }
>
>
> Please do not send two patches with the same $subject that are fixing
> two different areas of the driver. In fact, please squash these two
> patches into a single fix and resend because they are fixing the same issue.
Sure, I will prepare a version 2 with your suggestions.
>
> Jon
>
> --
> nvpublic
--
Navid.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure
2020-06-03 18:41 Navid Emamdoost
@ 2020-06-04 17:45 ` Jon Hunter
2020-06-04 17:48 ` Navid Emamdoost
0 siblings, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2020-06-04 17:45 UTC (permalink / raw)
To: Navid Emamdoost, Laxman Dewangan, Vinod Koul, Dan Williams,
Thierry Reding, dmaengine, linux-tegra, linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman
On 03/06/2020 19:41, 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 | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
> index c4ce5dfb149b..e8c749cd3fe8 100644
> --- a/drivers/dma/tegra210-adma.c
> +++ b/drivers/dma/tegra210-adma.c
> @@ -659,6 +659,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc)
> ret = pm_runtime_get_sync(tdc2dev(tdc));
> if (ret < 0) {
> free_irq(tdc->irq, tdc);
> + pm_runtime_put(tdc2dev(tdc));
> return ret;
> }
Please do not send two patches with the same $subject that are fixing
two different areas of the driver. In fact, please squash these two
patches into a single fix and resend because they are fixing the same issue.
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure
@ 2020-06-03 18:41 Navid Emamdoost
2020-06-04 17:45 ` Jon Hunter
0 siblings, 1 reply; 5+ messages in thread
From: Navid Emamdoost @ 2020-06-03 18:41 UTC (permalink / raw)
To: Laxman Dewangan, Jon Hunter, Vinod Koul, Dan Williams,
Thierry Reding, dmaengine, linux-tegra, linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index c4ce5dfb149b..e8c749cd3fe8 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -659,6 +659,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc)
ret = pm_runtime_get_sync(tdc2dev(tdc));
if (ret < 0) {
free_irq(tdc->irq, tdc);
+ pm_runtime_put(tdc2dev(tdc));
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-04 17:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 18:38 [PATCH] dmaengine: tegra210-adma: fix pm_runtime_get_sync failure Navid Emamdoost
2020-06-04 17:43 ` Jon Hunter
2020-06-03 18:41 Navid Emamdoost
2020-06-04 17:45 ` Jon Hunter
2020-06-04 17:48 ` Navid Emamdoost
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).