* [PATCH] dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails
@ 2020-06-03 18:28 Navid Emamdoost
2020-06-24 7:46 ` Vinod Koul
0 siblings, 1 reply; 5+ messages in thread
From: Navid Emamdoost @ 2020-06-03 18:28 UTC (permalink / raw)
To: Vinod Koul, Dan Williams, Maxime Coquelin, Alexandre Torgue,
dmaengine, linux-stm32, linux-arm-kernel, linux-kernel
Cc: Navid Emamdoost, emamd001, kjlu, wu000273, smccaman
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/stm32-mdma.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
index 5469563703d1..79bee1bb73f6 100644
--- a/drivers/dma/stm32-mdma.c
+++ b/drivers/dma/stm32-mdma.c
@@ -1449,8 +1449,10 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c)
}
ret = pm_runtime_get_sync(dmadev->ddev.dev);
- if (ret < 0)
+ if (ret < 0) {
+ pm_runtime_put(dmadev->ddev.dev);
return ret;
+ }
ret = stm32_mdma_disable_chan(chan);
if (ret < 0)
@@ -1718,8 +1720,10 @@ static int stm32_mdma_pm_suspend(struct device *dev)
int ret;
ret = pm_runtime_get_sync(dev);
- if (ret < 0)
+ if (ret < 0) {
+ pm_runtime_put_sync(dev);
return ret;
+ }
for (id = 0; id < dmadev->nr_channels; id++) {
ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(id));
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails
[not found] <873bfb31-52d8-7c9b-5480-4a94dc945307@web.de>
@ 2020-06-03 19:17 ` Navid Emamdoost
2020-06-17 13:59 ` Vinod Koul
2020-06-03 22:01 ` Geert Uytterhoeven
1 sibling, 1 reply; 5+ messages in thread
From: Navid Emamdoost @ 2020-06-03 19:17 UTC (permalink / raw)
To: Markus Elfring
Cc: Maxime Coquelin, Alexandre Torgue, kernel-janitors, Kangjie Lu,
LKML, Vinod Koul, Navid Emamdoost, Qiushi Wu, Stephen McCamant,
dmaengine, Dan Williams, linux-stm32, linux-arm-kernel
On Wed, Jun 3, 2020 at 1:52 PM Markus Elfring <Markus.Elfring@web.de> 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.
>
> Is it appropriate to copy a sentence from the change description
> into the patch subject?
>
> How do you think about a wording variant like the following?
Please stop proposing rewording on my patches!
I will consider updating my patches only if a maintainer asks for it.
>
> The PM runtime reference counter is generally incremented by a call of
> the function “pm_runtime_get_sync”.
> Thus call the function “pm_runtime_put” also in two error cases
> to keep the reference counting consistent.
>
>
> Would you like to add the tag “Fixes” to the commit message?
>
> Regards,
> Markus
--
Navid.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails
[not found] <873bfb31-52d8-7c9b-5480-4a94dc945307@web.de>
2020-06-03 19:17 ` Navid Emamdoost
@ 2020-06-03 22:01 ` Geert Uytterhoeven
1 sibling, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2020-06-03 22:01 UTC (permalink / raw)
To: Markus Elfring
Cc: Maxime Coquelin, Alexandre Torgue, kernel-janitors, Kangjie Lu,
Linux Kernel Mailing List, Vinod Koul, Navid Emamdoost, Qiushi Wu,
Stephen McCamant, dmaengine, Dan Williams, linux-stm32, Linux ARM,
Navid Emamdoost
Hi Markus,
Thanks for your comment!
On Wed, Jun 3, 2020 at 8:53 PM Markus Elfring <Markus.Elfring@web.de> 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.
>
> Is it appropriate to copy a sentence from the change description
> into the patch subject?
>
> How do you think about a wording variant like the following?
>
> The PM runtime reference counter is generally incremented by a call of
> the function “pm_runtime_get_sync”.
> Thus call the function “pm_runtime_put” also in two error cases
> to keep the reference counting consistent.
IMHO the important part is "even in case of failure", which you dropped.
Missing that point was the root cause of the issue being fixed.
Hence I prefer the original description, FWIW.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails
2020-06-03 19:17 ` Navid Emamdoost
@ 2020-06-17 13:59 ` Vinod Koul
0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2020-06-17 13:59 UTC (permalink / raw)
To: Navid Emamdoost
Cc: Maxime Coquelin, Alexandre Torgue, kernel-janitors, Kangjie Lu,
LKML, Navid Emamdoost, Markus Elfring, Qiushi Wu,
Stephen McCamant, dmaengine, Dan Williams, linux-stm32,
linux-arm-kernel
On 03-06-20, 14:17, Navid Emamdoost wrote:
> On Wed, Jun 3, 2020 at 1:52 PM Markus Elfring <Markus.Elfring@web.de> 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.
> >
> > Is it appropriate to copy a sentence from the change description
> > into the patch subject?
> >
> > How do you think about a wording variant like the following?
> Please stop proposing rewording on my patches!
>
> I will consider updating my patches only if a maintainer asks for it.
Yeah ignore these :) no one takes this 'bot' seriously, it is annoying
yes :(
> >
> > The PM runtime reference counter is generally incremented by a call of
> > the function “pm_runtime_get_sync”.
> > Thus call the function “pm_runtime_put” also in two error cases
> > to keep the reference counting consistent.
> >
> >
> > Would you like to add the tag “Fixes” to the commit message?
> >
> > Regards,
> > Markus
>
>
>
> --
> Navid.
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails
2020-06-03 18:28 [PATCH] dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails Navid Emamdoost
@ 2020-06-24 7:46 ` Vinod Koul
0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2020-06-24 7:46 UTC (permalink / raw)
To: Navid Emamdoost
Cc: Alexandre Torgue, wu000273, kjlu, linux-kernel, emamd001,
Maxime Coquelin, smccaman, dmaengine, Dan Williams, linux-stm32,
linux-arm-kernel
On 03-06-20, 13:28, 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/stm32-mdma.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
> index 5469563703d1..79bee1bb73f6 100644
> --- a/drivers/dma/stm32-mdma.c
> +++ b/drivers/dma/stm32-mdma.c
> @@ -1449,8 +1449,10 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c)
> }
>
> ret = pm_runtime_get_sync(dmadev->ddev.dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put(dmadev->ddev.dev);
> return ret;
> + }
>
> ret = stm32_mdma_disable_chan(chan);
> if (ret < 0)
> @@ -1718,8 +1720,10 @@ static int stm32_mdma_pm_suspend(struct device *dev)
> int ret;
>
> ret = pm_runtime_get_sync(dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put_sync(dev);
Not put_sync()...
> return ret;
> + }
>
> for (id = 0; id < dmadev->nr_channels; id++) {
> ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(id));
> --
> 2.17.1
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-24 7: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:28 [PATCH] dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails Navid Emamdoost
2020-06-24 7:46 ` Vinod Koul
[not found] <873bfb31-52d8-7c9b-5480-4a94dc945307@web.de>
2020-06-03 19:17 ` Navid Emamdoost
2020-06-17 13:59 ` Vinod Koul
2020-06-03 22:01 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox