From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: Srinivas Kandagatla <srini@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, Oder Chiou <oder_chiou@realtek.com>,
Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
Baojun Xu <baojun.xu@ti.com>,
David Rhodes <david.rhodes@cirrus.com>,
patches@opensource.cirrus.com,
Bartosz Golaszewski <brgl@kernel.org>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Charles Keepax <ckeepax@opensource.cirrus.com>,
Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>,
Shengjiu Wang <shengjiu.wang@nxp.com>,
Sharique Mohammad <sharq0406@gmail.com>
Subject: Re: [PATCH 14/19] ASoC: codecs: wm8962: Propagate regcache_sync() errors
Date: Mon, 6 Jul 2026 10:11:35 +0100 [thread overview]
Message-ID: <e0c106fd-4ebe-4ddc-b83b-190e17e49d29@opensource.cirrus.com> (raw)
In-Reply-To: <20260704040220.12045-1-pengpeng@iscas.ac.cn>
On 04/07/2026 5:02 am, Pengpeng Hou wrote:
> regcache_sync() can fail while replaying cached register state during
> runtime resume. wm8962_runtime_resume() currently ignores that failure
> and continues programming the device.
>
> Propagate the error, restore cache-only/dirty state, and unwind the
> supplies and clock acquired by runtime resume.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> sound/soc/codecs/wm8962.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
> index de18b1f85a32..2db822fc1de7 100644
> --- a/sound/soc/codecs/wm8962.c
> +++ b/sound/soc/codecs/wm8962.c
> @@ -3937,7 +3937,9 @@ static int wm8962_runtime_resume(struct device *dev)
> WM8962_OSC_ENA | WM8962_PLL2_ENA | WM8962_PLL3_ENA,
> 0);
>
What about the regmap writes that happen before this?
There is a regmap_write_bits() and two regmap_update_bits() that could
fail before we get to the regcache_sync() but they aren't checked for
error.
> - regcache_sync(wm8962->regmap);
> + ret = regcache_sync(wm8962->regmap);
> + if (ret)
> + goto cache_sync_err;
>
> regmap_update_bits(wm8962->regmap, WM8962_ANTI_POP,
> WM8962_STARTUP_BIAS_ENA | WM8962_VMID_BUF_ENA,
> @@ -3955,6 +3957,11 @@ static int wm8962_runtime_resume(struct device *dev)
>
> return 0;
>
> +cache_sync_err:
Should this error path revert the three regmap writes that were done
before the regcache_sync() ?
> + regcache_cache_only(wm8962->regmap, true);
> + regcache_mark_dirty(wm8962->regmap);
> + regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies),
> + wm8962->supplies);
> disable_clock:
> clk_disable_unprepare(wm8962->pdata.mclk);
> return ret;
next prev parent reply other threads:[~2026-07-06 9:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 3:48 [PATCH 00/19] ASoC: codecs: propagate regcache_sync() failures Pengpeng Hou
2026-07-04 3:49 ` [PATCH 01/19] ASoC: codecs: lpass-rx-macro: Propagate regcache_sync() errors Pengpeng Hou
2026-07-04 3:50 ` [PATCH 02/19] ASoC: codecs: lpass-tx-macro: " Pengpeng Hou
2026-07-04 3:51 ` [PATCH 03/19] ASoC: codecs: lpass-wsa-macro: " Pengpeng Hou
2026-07-04 3:52 ` [PATCH 04/19] ASoC: codecs: max98373: " Pengpeng Hou
2026-07-04 3:53 ` [PATCH 05/19] ASoC: codecs: max98388: " Pengpeng Hou
2026-07-04 3:54 ` [PATCH 06/19] ASoC: codecs: rt1318-sdw: " Pengpeng Hou
2026-07-04 3:55 ` [PATCH 07/19] ASoC: codecs: rt9120: " Pengpeng Hou
2026-07-04 3:57 ` [PATCH 08/19] ASoC: codecs: tas2552: " Pengpeng Hou
2026-07-04 3:57 ` [PATCH 09/19] ASoC: codecs: tas2783-sdw: " Pengpeng Hou
2026-07-04 3:58 ` [PATCH 10/19] ASoC: codecs: wcd938x-sdw: " Pengpeng Hou
2026-07-04 3:59 ` [PATCH 11/19] ASoC: codecs: cs35l32: " Pengpeng Hou
2026-07-04 4:00 ` [PATCH 12/19] ASoC: codecs: wm2200: " Pengpeng Hou
2026-07-06 9:00 ` Richard Fitzgerald
2026-07-04 4:01 ` [PATCH 13/19] ASoC: codecs: wm5100: " Pengpeng Hou
2026-07-04 4:02 ` [PATCH 14/19] ASoC: codecs: wm8962: " Pengpeng Hou
2026-07-06 9:11 ` Richard Fitzgerald [this message]
2026-07-06 12:37 ` Mark Brown
2026-07-04 4:03 ` [PATCH 15/19] ASoC: codecs: cs4349: " Pengpeng Hou
2026-07-06 9:03 ` Richard Fitzgerald
2026-07-04 4:04 ` [PATCH 16/19] ASoC: codecs: rt1320-sdw: " Pengpeng Hou
2026-07-04 4:05 ` [PATCH 17/19] ASoC: codecs: rt5682-sdw: " Pengpeng Hou
2026-07-04 4:06 ` [PATCH 18/19] ASoC: codecs: max98396: Unwind supplies on resume failure Pengpeng Hou
2026-07-04 4:07 ` [PATCH 19/19] ASoC: codecs: max98090: Propagate runtime regcache_sync() errors Pengpeng Hou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e0c106fd-4ebe-4ddc-b83b-190e17e49d29@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=baojun.xu@ti.com \
--cc=brgl@kernel.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=david.rhodes@cirrus.com \
--cc=kevin-lu@ti.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=patches@opensource.cirrus.com \
--cc=pengpeng@iscas.ac.cn \
--cc=perex@perex.cz \
--cc=sebastian.krzyszkowiak@puri.sm \
--cc=sharq0406@gmail.com \
--cc=shenghao-ding@ti.com \
--cc=shengjiu.wang@nxp.com \
--cc=srini@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox