All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhangqilong <zhangqilong3@huawei.com>
To: <frattaroli.nicolas@gmail.com>, <tiwai@suse.com>,
	<perex@perex.cz>, <heiko@sntech.de>
Cc: <lgirdwood@gmail.com>, <broonie@kernel.org>,
	<linux-rockchip@lists.infradead.org>,
	<alsa-devel@alsa-project.org>
Subject: [PATCH -next] ASoC: rockchip: Fix PM usage reference of rockchip_i2s_tdm_resume
Date: Tue, 15 Mar 2022 10:54:15 +0800	[thread overview]
Message-ID: <20220315025415.2593762-1-zhangqilong3@huawei.com> (raw)

pm_runtime_get_sync will increment pm usage counter
even it failed. Forgetting to putting operation will
result in reference leak here. We fix it by replacing
it with pm_runtime_resume_and_get to keep usage counter
balanced.

Fixes:081068fd64140 ("ASoC: rockchip: add support for i2s-tdm controller")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index 5f9cb5c4c7f0..d3b710406941 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -1738,7 +1738,7 @@ static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)
 	struct rk_i2s_tdm_dev *i2s_tdm = dev_get_drvdata(dev);
 	int ret;
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0)
 		return ret;
 	ret = regcache_sync(i2s_tdm->regmap);
-- 
2.31.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: zhangqilong <zhangqilong3@huawei.com>
To: <frattaroli.nicolas@gmail.com>, <tiwai@suse.com>,
	<perex@perex.cz>, <heiko@sntech.de>
Cc: linux-rockchip@lists.infradead.org, alsa-devel@alsa-project.org,
	broonie@kernel.org, lgirdwood@gmail.com
Subject: [PATCH -next] ASoC: rockchip: Fix PM usage reference of rockchip_i2s_tdm_resume
Date: Tue, 15 Mar 2022 10:54:15 +0800	[thread overview]
Message-ID: <20220315025415.2593762-1-zhangqilong3@huawei.com> (raw)

pm_runtime_get_sync will increment pm usage counter
even it failed. Forgetting to putting operation will
result in reference leak here. We fix it by replacing
it with pm_runtime_resume_and_get to keep usage counter
balanced.

Fixes:081068fd64140 ("ASoC: rockchip: add support for i2s-tdm controller")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index 5f9cb5c4c7f0..d3b710406941 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -1738,7 +1738,7 @@ static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)
 	struct rk_i2s_tdm_dev *i2s_tdm = dev_get_drvdata(dev);
 	int ret;
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0)
 		return ret;
 	ret = regcache_sync(i2s_tdm->regmap);
-- 
2.31.1


             reply	other threads:[~2022-03-15  2:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  2:54 zhangqilong [this message]
2022-03-15  2:54 ` [PATCH -next] ASoC: rockchip: Fix PM usage reference of rockchip_i2s_tdm_resume zhangqilong
2022-03-16 19:06 ` Nicolas Frattaroli
2022-03-16 19:06   ` Nicolas Frattaroli
2022-03-16 20:35 ` Mark Brown
2022-03-16 20:35   ` Mark Brown

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=20220315025415.2593762-1-zhangqilong3@huawei.com \
    --to=zhangqilong3@huawei.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=frattaroli.nicolas@gmail.com \
    --cc=heiko@sntech.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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.