* [PATCH] ASoC: rockchip: i2s_tdm: fix runtime pm imbalance on error
@ 2022-03-02 10:00 Zhen Ni
2022-03-02 10:04 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Zhen Ni @ 2022-03-02 10:00 UTC (permalink / raw)
To: frattaroli.nicolas, lgirdwood, broonie, tiwai
Cc: alsa-devel, linux-kernel, Zhen Ni
pm_runtime_get_sync() increments the runtime PM usage counter even the
call returns an error code. Thus a pairing decrement is needed on the
error handling path to keep the counter balanced.
Signed-off-by: Zhen Ni <nizhen@uniontech.com>
---
sound/soc/rockchip/rockchip_i2s_tdm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index 5f9cb5c4c7f0..4691a76b499d 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -1739,8 +1739,10 @@ static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)
int ret;
ret = pm_runtime_get_sync(dev);
- if (ret < 0)
+ if (ret < 0) {
+ pm_runtime_put(dev);
return ret;
+ }
ret = regcache_sync(i2s_tdm->regmap);
pm_runtime_put(dev);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: rockchip: i2s_tdm: fix runtime pm imbalance on error
2022-03-02 10:00 [PATCH] ASoC: rockchip: i2s_tdm: fix runtime pm imbalance on error Zhen Ni
@ 2022-03-02 10:04 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2022-03-02 10:04 UTC (permalink / raw)
To: Zhen Ni
Cc: frattaroli.nicolas, lgirdwood, broonie, tiwai, alsa-devel,
linux-kernel
On Wed, 02 Mar 2022 11:00:19 +0100,
Zhen Ni wrote:
>
> pm_runtime_get_sync() increments the runtime PM usage counter even the
> call returns an error code. Thus a pairing decrement is needed on the
> error handling path to keep the counter balanced.
>
> Signed-off-by: Zhen Ni <nizhen@uniontech.com>
Better to use a new function pm_runtime_resume_and_get().
thanks,
Takashi
> ---
> sound/soc/rockchip/rockchip_i2s_tdm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
> index 5f9cb5c4c7f0..4691a76b499d 100644
> --- a/sound/soc/rockchip/rockchip_i2s_tdm.c
> +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
> @@ -1739,8 +1739,10 @@ static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)
> int ret;
>
> ret = pm_runtime_get_sync(dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put(dev);
> return ret;
> + }
> ret = regcache_sync(i2s_tdm->regmap);
> pm_runtime_put(dev);
>
> --
> 2.20.1
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-02 10:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-02 10:00 [PATCH] ASoC: rockchip: i2s_tdm: fix runtime pm imbalance on error Zhen Ni
2022-03-02 10:04 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox