Skip to content

Commit a6a129b

Browse files
TomHsieh300Sasha Levin
authored andcommitted
ASoC: es8328: Add error unwind in resume
[ Upstream commit 8232e6079ae6f8d3a61d87973cb427385aa469b9 ] Handle failures in the resume path by unwinding previously enabled resources. If enabling regulators or syncing the regcache fails, disable regulators and unprepare the clock to avoid leaking resources and leaving the device in a partially resumed state. Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com> Link: https://patch.msgid.link/20260130160017.2630-6-hungen3108@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2b0babc commit a6a129b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

sound/soc/codecs/es8328.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,17 +750,23 @@ static int es8328_resume(struct snd_soc_component *component)
750750
es8328->supplies);
751751
if (ret) {
752752
dev_err(component->dev, "unable to enable regulators\n");
753-
return ret;
753+
goto err_clk;
754754
}
755755

756756
regcache_mark_dirty(regmap);
757757
ret = regcache_sync(regmap);
758758
if (ret) {
759759
dev_err(component->dev, "unable to sync regcache\n");
760-
return ret;
760+
goto err_regulators;
761761
}
762762

763763
return 0;
764+
765+
err_regulators:
766+
regulator_bulk_disable(ARRAY_SIZE(es8328->supplies), es8328->supplies);
767+
err_clk:
768+
clk_disable_unprepare(es8328->clk);
769+
return ret;
764770
}
765771

766772
static int es8328_component_probe(struct snd_soc_component *component)

0 commit comments

Comments
 (0)