]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: rockchip: Fix a reference count leak.
authorQiushi Wu <wu000273@umn.edu>
Sat, 13 Jun 2020 20:51:58 +0000 (15:51 -0500)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:38:04 +0000 (15:38 -0400)
[ Upstream commit f141a422159a199f4c8dedb7e0df55b3b2cf16cd ]

Calling pm_runtime_get_sync increments the counter even in case of
failure, causing incorrect ref count if pm_runtime_put is not called in
error handling paths. Call pm_runtime_put if pm_runtime_get_sync fails.

Fixes: fc05a5b22253 ("ASoC: rockchip: add support for pdm controller")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20200613205158.27296-1-wu000273@umn.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/rockchip/rockchip_pdm.c

index 8a2e3bbce3a165515f8def7c83e25e4b905b1e2d..ad16c8310dd386337a79636301289246ca6e7a4d 100644 (file)
@@ -478,8 +478,10 @@ static int rockchip_pdm_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(pdm->regmap);