]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: tegra: Fix reference count leaks.
authorQiushi Wu <wu000273@umn.edu>
Sat, 13 Jun 2020 20:44:19 +0000 (15:44 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:26:42 +0000 (11:26 +0200)
[ Upstream commit deca195383a6085be62cb453079e03e04d618d6e ]

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>
Signed-off-by: Sasha Levin <sashal@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 e6d548fa980b68e834d000e422fcd9beb5853417..8894b7c16a01a96f687275c1fef121d72e992f83 100644 (file)
@@ -538,8 +538,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);