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 <[email protected]> Reviewed-by: Jon Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 668b150 commit deca195

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

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)