Skip to content

Commit deca195

Browse files
QiushiWubroonie
authored andcommitted
ASoC: tegra: Fix reference count leaks.
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>
1 parent 668b150 commit deca195

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

sound/soc/tegra/tegra30_ahub.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,10 @@ static int tegra30_ahub_resume(struct device *dev)
643643
int ret;
644644

645645
ret = pm_runtime_get_sync(dev);
646-
if (ret < 0)
646+
if (ret < 0) {
647+
pm_runtime_put(dev);
647648
return ret;
649+
}
648650
ret = regcache_sync(ahub->regmap_ahub);
649651
ret |= regcache_sync(ahub->regmap_apbif);
650652
pm_runtime_put(dev);

sound/soc/tegra/tegra30_i2s.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,10 @@ static int tegra30_i2s_resume(struct device *dev)
567567
int ret;
568568

569569
ret = pm_runtime_get_sync(dev);
570-
if (ret < 0)
570+
if (ret < 0) {
571+
pm_runtime_put(dev);
571572
return ret;
573+
}
572574
ret = regcache_sync(i2s->regmap);
573575
pm_runtime_put(dev);
574576

0 commit comments

Comments
 (0)