Skip to content

Commit

Permalink
ASoC: tegra: Fix reference count leaks.
Browse files Browse the repository at this point in the history
[ Upstream commit deca195 ]

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>
  • Loading branch information
QiushiWu authored and gregkh committed Sep 3, 2020
1 parent d5581a8 commit dd80a72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion sound/soc/tegra/tegra30_ahub.c
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion sound/soc/tegra/tegra30_i2s.c
Expand Up @@ -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);

Expand Down

0 comments on commit dd80a72

Please sign in to comment.