[PATCH] ASoC: max9860: Disable DVDDIO on runtime resume failure

From: Haowen Tu

Date: Tue Dec 01 2026 - 21:13:07 EST


max9860_resume() enables DVDDIO before synchronizing the register cache
and restoring the clock configuration. If either register operation
fails, it returns without disabling the supply. This leaves the regulator
enable count elevated even though the runtime resume has failed, and a
subsequent suspend callback cannot be relied on to balance it.

Disable DVDDIO on both failure paths and preserve the original error.
Restore cache-only mode before releasing the supply, including when a
shared regulator remains enabled and no disable notification is sent.

Fixes: 3b2af7f79968 ("ASoC: max9860: new driver")
Signed-off-by: Haowen Tu <tuhaowen@xxxxxxxxxxxxx>
---
sound/soc/codecs/max9860.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/max9860.c b/sound/soc/codecs/max9860.c
index a25f6891fe2f..8da4091c4ab5 100644
--- a/sound/soc/codecs/max9860.c
+++ b/sound/soc/codecs/max9860.c
@@ -594,17 +594,22 @@ static int max9860_resume(struct device *dev)
ret = regcache_sync(max9860->regmap);
if (ret) {
dev_err(dev, "Failed to sync cache: %d\n", ret);
- return ret;
+ goto err_regulator;
}

ret = regmap_update_bits(max9860->regmap, MAX9860_SYSCLK,
MAX9860_PSCLK, max9860->psclk);
if (ret) {
dev_err(dev, "Failed to enable clock: %d\n", ret);
- return ret;
+ goto err_regulator;
}

return 0;
+
+err_regulator:
+ regcache_cache_only(max9860->regmap, true);
+ regulator_disable(max9860->dvddio);
+ return ret;
}

static const struct dev_pm_ops max9860_pm_ops = {
--
2.50.1