[PATCH] ALSA: ac97: fix reference leak in ac97_bus_remove

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pm_runtime_get_sync() will increase pm usage counter even it
failed. We should call pm_runtime_put_noidle to decrease it
to prevent reference leak.

Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx>
---
 sound/ac97/bus.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
index 7985dd8198b6..2c4779d851ad 100644
--- a/sound/ac97/bus.c
+++ b/sound/ac97/bus.c
@@ -521,8 +521,11 @@ static int ac97_bus_remove(struct device *dev)
 	int ret;
 
 	ret = pm_runtime_get_sync(dev);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_err(dev, "Failed to enable device: %d\n", ret);
+		pm_runtime_put_noidle(dev);
 		return ret;
+	}
 
 	ret = adrv->remove(adev);
 	pm_runtime_put_noidle(dev);
-- 
2.17.1




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux