[4/5] ASoC: sun8i-codec: fix bus clock leak in runtime resume error path

Message ID 20261107160825704ak9coG8uWvEC-daLg4OkT@zte.com.cn (mailing list archive)
State New
Headers
Series ASoC: fix error-path leaks and a NULL dereference |

Commit Message

shao.mingyin@zte.com.cn Nov. 7, 2026, 8:08 a.m. UTC
From: Shao Mingyin <shao.mingyin@zte.com.cn>

sun8i_codec_runtime_resume() enables the bus clock and then calls
regcache_sync().  If the sync fails, it returns without disabling the
clock, so a failed resume leaves the bus clock enabled and its enable
count unbalanced.

Disable the clock before returning on the error path, as
sun4i_i2s_runtime_resume() already does for the same failure.

Fixes: 36c684936fae ("ASoC: Add sun8i digital audio codec")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
  

Patch

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 2e4a205e4e56..e7d5c81ae1ef 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -259,6 +259,7 @@  static int sun8i_codec_runtime_resume(struct device *dev)
 	ret = regcache_sync(scodec->regmap);
 	if (ret) {
 		dev_err(dev, "Failed to sync regmap cache\n");
+		clk_disable_unprepare(scodec->clk_bus);
 		return ret;
 	}