All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: ac97: fix PM reference leak in ac97_bus_remove()
@ 2021-05-24  9:38 Yufen Yu
  2021-05-25  6:59 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Yufen Yu @ 2021-05-24  9:38 UTC (permalink / raw)
  To: alsa-devel; +Cc: yukuai3, tiwai, yuyufen

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

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 sound/ac97/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
index d9077e91382b..6ddf646cda65 100644
--- a/sound/ac97/bus.c
+++ b/sound/ac97/bus.c
@@ -520,7 +520,7 @@ static int ac97_bus_remove(struct device *dev)
 	struct ac97_codec_driver *adrv = to_ac97_driver(dev->driver);
 	int ret;
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0)
 		return ret;
 
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: ac97: fix PM reference leak in ac97_bus_remove()
  2021-05-24  9:38 [PATCH] ALSA: ac97: fix PM reference leak in ac97_bus_remove() Yufen Yu
@ 2021-05-25  6:59 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-05-25  6:59 UTC (permalink / raw)
  To: Yufen Yu; +Cc: yukuai3, alsa-devel, tiwai

On Mon, 24 May 2021 11:38:11 +0200,
Yufen Yu wrote:
> 
> pm_runtime_get_sync will increment pm usage counter even it failed.
> Forgetting to putting operation will result in reference leak here.
> Fix it by replacing it with pm_runtime_resume_and_get to keep usage
> counter balanced.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>

Thanks, applied.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-25  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  9:38 [PATCH] ALSA: ac97: fix PM reference leak in ac97_bus_remove() Yufen Yu
2021-05-25  6:59 ` Takashi Iwai

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.