mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors
@ 2026-07-04  7:27 Pengpeng Hou
  2026-07-06  8:37 ` Richard Fitzgerald
  2026-07-06 13:03 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Pengpeng Hou @ 2026-07-04  7:27 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-sound, patches,
	linux-kernel
  Cc: Pengpeng Hou

cs42l42_sdw_runtime_resume() first syncs LATCH_TO_VP and then syncs the
full regmap, but currently ignores both return values and can report
success after a failed replay.

Check both sync operations, return the first error, and restore cache-
only/dirty state on failure.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 sound/soc/codecs/cs42l42-sdw.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cs42l42-sdw.c b/sound/soc/codecs/cs42l42-sdw.c
index ad1256910a18..b61ca74dcf0b 100644
--- a/sound/soc/codecs/cs42l42-sdw.c
+++ b/sound/soc/codecs/cs42l42-sdw.c
@@ -481,10 +481,20 @@ static int cs42l42_sdw_runtime_resume(struct device *dev)
 	regcache_cache_only(cs42l42->regmap, false);
 
 	/* Sync LATCH_TO_VP first so the VP domain registers sync correctly */
-	regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1);
-	regcache_sync(cs42l42->regmap);
+	ret = regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1);
+	if (ret)
+		goto err_sync;
+
+	ret = regcache_sync(cs42l42->regmap);
+	if (ret)
+		goto err_sync;
 
 	return 0;
+
+err_sync:
+	regcache_cache_only(cs42l42->regmap, true);
+	regcache_mark_dirty(cs42l42->regmap);
+	return ret;
 }
 
 static int cs42l42_sdw_resume(struct device *dev)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors
  2026-07-04  7:27 [PATCH] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors Pengpeng Hou
@ 2026-07-06  8:37 ` Richard Fitzgerald
  2026-07-06 13:03 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Fitzgerald @ 2026-07-06  8:37 UTC (permalink / raw)
  To: Pengpeng Hou, David Rhodes, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-sound, patches,
	linux-kernel

On 04/07/2026 8:27 am, Pengpeng Hou wrote:
> cs42l42_sdw_runtime_resume() first syncs LATCH_TO_VP and then syncs the
> full regmap, but currently ignores both return values and can report
> success after a failed replay.
> 
> Check both sync operations, return the first error, and restore cache-
> only/dirty state on failure.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>   sound/soc/codecs/cs42l42-sdw.c | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/cs42l42-sdw.c b/sound/soc/codecs/cs42l42-sdw.c
> index ad1256910a18..b61ca74dcf0b 100644
> --- a/sound/soc/codecs/cs42l42-sdw.c
> +++ b/sound/soc/codecs/cs42l42-sdw.c
> @@ -481,10 +481,20 @@ static int cs42l42_sdw_runtime_resume(struct device *dev)
>   	regcache_cache_only(cs42l42->regmap, false);
>   
>   	/* Sync LATCH_TO_VP first so the VP domain registers sync correctly */
> -	regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1);
> -	regcache_sync(cs42l42->regmap);
> +	ret = regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1);
> +	if (ret)
> +		goto err_sync;
> +
> +	ret = regcache_sync(cs42l42->regmap);
> +	if (ret)
> +		goto err_sync;
>   
>   	return 0;
> +
> +err_sync:
> +	regcache_cache_only(cs42l42->regmap, true);
> +	regcache_mark_dirty(cs42l42->regmap);
> +	return ret;
>   }
>   
>   static int cs42l42_sdw_resume(struct device *dev)

Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors
  2026-07-04  7:27 [PATCH] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors Pengpeng Hou
  2026-07-06  8:37 ` Richard Fitzgerald
@ 2026-07-06 13:03 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-07-06 13:03 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, linux-sound, patches, linux-kernel, Pengpeng Hou

On Sat, 04 Jul 2026 15:27:12 +0800, Pengpeng Hou wrote:
> ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3

Thanks!

[1/1] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors
      https://git.kernel.org/broonie/sound/c/a118fea777a2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-06 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-04  7:27 [PATCH] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors Pengpeng Hou
2026-07-06  8:37 ` Richard Fitzgerald
2026-07-06 13:03 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox