* [PATCH] media: staging: tegra-vde: add missing pm_runtime_put_autosuspend
@ 2020-06-02 5:48 Navid Emamdoost
[not found] ` <20200602054841.15746-1-navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Navid Emamdoost @ 2020-06-02 5:48 UTC (permalink / raw)
To: Dmitry Osipenko, Mauro Carvalho Chehab, Greg Kroah-Hartman,
Thierry Reding, Jonathan Hunter, linux-media, linux-tegra, devel,
linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost
Call to pm_runtime_get_sync increments counter even in case of
failure leading to incorrect ref count.
Call pm_runtime_put_autosuspend if pm_runtime_get_sync fails.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/staging/media/tegra-vde/vde.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c
index d3e63512a765..52cdd4a91e93 100644
--- a/drivers/staging/media/tegra-vde/vde.c
+++ b/drivers/staging/media/tegra-vde/vde.c
@@ -776,8 +776,10 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde,
goto release_dpb_frames;
ret = pm_runtime_get_sync(dev);
- if (ret < 0)
+ if (ret < 0) {
+ pm_runtime_put_autosuspend(dev);
goto unlock;
+ }
/*
* We rely on the VDE registers reset value, otherwise VDE
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <20200602054841.15746-1-navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] media: staging: tegra-vde: add missing pm_runtime_put_autosuspend [not found] ` <20200602054841.15746-1-navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2020-06-05 6:00 ` Jon Hunter [not found] ` <7061eb81-c00c-9978-5e4b-f9896c0ffd5e-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Jon Hunter @ 2020-06-05 6:00 UTC (permalink / raw) To: Navid Emamdoost, Dmitry Osipenko, Mauro Carvalho Chehab, Greg Kroah-Hartman, Thierry Reding, linux-media-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: emamd001-OJFnDUYgAso, wu000273-OJFnDUYgAso, kjlu-OJFnDUYgAso, smccaman-OJFnDUYgAso On 02/06/2020 06:48, Navid Emamdoost wrote: > Call to pm_runtime_get_sync increments counter even in case of > failure leading to incorrect ref count. > Call pm_runtime_put_autosuspend if pm_runtime_get_sync fails. > > Signed-off-by: Navid Emamdoost <navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- > drivers/staging/media/tegra-vde/vde.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c > index d3e63512a765..52cdd4a91e93 100644 > --- a/drivers/staging/media/tegra-vde/vde.c > +++ b/drivers/staging/media/tegra-vde/vde.c > @@ -776,8 +776,10 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, > goto release_dpb_frames; > > ret = pm_runtime_get_sync(dev); > - if (ret < 0) > + if (ret < 0) { > + pm_runtime_put_autosuspend(dev); > goto unlock; > + } > > /* > * We rely on the VDE registers reset value, otherwise VDE Please use the put in the error path. Jon -- nvpublic ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <7061eb81-c00c-9978-5e4b-f9896c0ffd5e-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] media: staging: tegra-vde: add missing pm_runtime_put_autosuspend [not found] ` <7061eb81-c00c-9978-5e4b-f9896c0ffd5e-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2020-06-05 14:05 ` Dmitry Osipenko 0 siblings, 0 replies; 4+ messages in thread From: Dmitry Osipenko @ 2020-06-05 14:05 UTC (permalink / raw) To: Jon Hunter, Navid Emamdoost, Mauro Carvalho Chehab, Greg Kroah-Hartman, Thierry Reding, linux-media-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: emamd001-OJFnDUYgAso, wu000273-OJFnDUYgAso, kjlu-OJFnDUYgAso, smccaman-OJFnDUYgAso 05.06.2020 09:00, Jon Hunter пишет: > > On 02/06/2020 06:48, Navid Emamdoost wrote: >> Call to pm_runtime_get_sync increments counter even in case of >> failure leading to incorrect ref count. >> Call pm_runtime_put_autosuspend if pm_runtime_get_sync fails. >> >> Signed-off-by: Navid Emamdoost <navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> --- >> drivers/staging/media/tegra-vde/vde.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c >> index d3e63512a765..52cdd4a91e93 100644 >> --- a/drivers/staging/media/tegra-vde/vde.c >> +++ b/drivers/staging/media/tegra-vde/vde.c >> @@ -776,8 +776,10 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, >> goto release_dpb_frames; >> >> ret = pm_runtime_get_sync(dev); >> - if (ret < 0) >> + if (ret < 0) { >> + pm_runtime_put_autosuspend(dev); >> goto unlock; >> + } >> >> /* >> * We rely on the VDE registers reset value, otherwise VDE > > Please use the put in the error path. This is a third version of the patch [1][2]. [1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200514210847.9269-2-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org/ [2] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200520095148.10995-1-dinghao.liu-Y5EWUtBUdg4nDS1+zs4M5A@public.gmane.org/ I'd prefer to stick with my variant of the patch [1] because in my opinion it's most straightforward variant and I actually tested that it works properly. Navid, anyways thank you for the patch. Next time please check if somebody else already sent similar patches before you. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: staging: tegra-vde: add missing pm_runtime_put_autosuspend
@ 2020-06-02 10:23 Markus Elfring
0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-06-02 10:23 UTC (permalink / raw)
To: Navid Emamdoost, devel, linux-media, linux-tegra
Cc: Navid Emamdoost, Kangjie Lu, Stephen McCamant, Qiushi Wu,
Mauro Carvalho Chehab, Dmitry Osipenko, Greg Kroah-Hartman,
Jonathan Hunter, Thierry Reding, LKML, kernel-janitors
> Call to pm_runtime_get_sync increments counter even in case of
> failure leading to incorrect ref count.
> Call pm_runtime_put_autosuspend if pm_runtime_get_sync fails.
How do you think about a wording variant like the following?
Change description:
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_autosuspend” also in one error case
to keep the reference counting consistent.
Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in threadend of thread, other threads:[~2020-06-05 14:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-02 5:48 [PATCH] media: staging: tegra-vde: add missing pm_runtime_put_autosuspend Navid Emamdoost
[not found] ` <20200602054841.15746-1-navid.emamdoost-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-06-05 6:00 ` Jon Hunter
[not found] ` <7061eb81-c00c-9978-5e4b-f9896c0ffd5e-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-06-05 14:05 ` Dmitry Osipenko
-- strict thread matches above, loose matches on Subject: below --
2020-06-02 10:23 Markus Elfring
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox