ASoC: ep93xx: Fix unchecked clk_prepare_enable() and add rollback on failure
authorJihed Chaibi <jihed.chaibi.dev@gmail.com>
Tue, 24 Mar 2026 21:09:09 +0000 (22:09 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 30 Mar 2026 18:38:22 +0000 (19:38 +0100)
commit622363757b2286dd2c2984b0d80255cbb35a0495
treefff964787486f04720a6dcd66e7b3bbe09b57a57
parentb9eff9732cb0f86a68c9d1592a98ceab47c01e95
ASoC: ep93xx: Fix unchecked clk_prepare_enable() and add rollback on failure

ep93xx_i2s_enable() calls clk_prepare_enable() on three clocks in
sequence (mclk, sclk, lrclk) without checking the return value of any
of them. If an intermediate enable fails, the clocks that were already
enabled are never rolled back, leaking them until the next disable cycle
— which may never come if the stream never started cleanly.

Change ep93xx_i2s_enable() from void to int. Add error checking after
each clk_prepare_enable() call and unwind already-enabled clocks on
failure. Propagate the error through ep93xx_i2s_startup() and
ep93xx_i2s_resume(), both of which already return int.

Signed-off-by: Jihed Chaibi <jihed.chaibi.dev@gmail.com>
Fixes: f4ff6b56bc8a ("ASoC: cirrus: i2s: Prepare clock before using it")
Link: https://patch.msgid.link/20260324210909.45494-1-jihed.chaibi.dev@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/cirrus/ep93xx-i2s.c