]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ASoC: tegra: Fix reference count leaks.
authorQiushi Wu <wu000273@umn.edu>
Sat, 13 Jun 2020 20:44:19 +0000 (15:44 -0500)
committerMark Brown <broonie@kernel.org>
Wed, 17 Jun 2020 13:04:02 +0000 (14:04 +0100)
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.

Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20200613204422.24484-1-wu000273@umn.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/tegra/tegra30_ahub.c
sound/soc/tegra/tegra30_i2s.c

index 635eacbd28d473f2711e227d3706a2b462619537..156e3b9d613c6eabaa8745ed0cfa510e3aaaaf3e 100644 (file)
@@ -643,8 +643,10 @@ static int tegra30_ahub_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(ahub->regmap_ahub);
        ret |= regcache_sync(ahub->regmap_apbif);
        pm_runtime_put(dev);
index d59882ec48f164664ae9eb88b8e9859f27112dfc..db5a8587bfa4c38b10334ac61c108c44bc5b79dc 100644 (file)
@@ -567,8 +567,10 @@ static int tegra30_i2s_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->regmap);
        pm_runtime_put(dev);