All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsl_easrc: Set firmware_loaded only after a successful resume
@ 2026-12-01 14:33 HyeongJun An
  2026-12-01 14:48 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: HyeongJun An @ 2026-12-01 14:33 UTC (permalink / raw)
  To: shengjiu.wang, broonie
  Cc: Xiubo.Lee, festevam, nicoleotsuka, lgirdwood, perex, tiwai,
	linux-sound, linuxppc-dev, linux-kernel, HyeongJun An

The fsl_easrc_runtime_resume() sets firmware_loaded before it requests
the firmware, and leaves it set when the request fails. The next resume
then returns early without the firmware, and a down-sampling hw_params
reads the NULL firmware_hdr.

A failed resume is retried since commit eef1d74bf88f ("PM: runtime:
Only set runtime_error on suspend callback failures"), so this now
happens on an i.MX8MP board without the firmware file. The KernelCI
kselftest-alsa runs on imx8mp-evk hit it in pcm-test:

  Internal error: Oops: 0000000096000004 [#1]  SMP
  pc : fsl_easrc_config_context+0x6ac/0xa70 [snd_soc_fsl_easrc]
  Call trace:
   fsl_easrc_config_context+0x6ac/0xa70 [snd_soc_fsl_easrc] (P)
   fsl_easrc_hw_params+0xdc/0x1e0 [snd_soc_fsl_easrc]

Set the flag only once the firmware is loaded and the coefficients are
written, so a failed resume is tried again in full.

Fixes: 955ac624058f ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers")
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
---
The crash shows in four kselftest-alsa runs on imx8mp-evk in the LAVA
lab, for example https://lava.sirena.org.uk/scheduler/job/300907
Each time one open of the EASRC PCM fails with -ENOENT and the next
one crashes in hw_params. With this patch every open fails instead.

Built for arm64. Not tested on hardware.

Prepared with Claude Code (Claude Opus 5.5).

 sound/soc/fsl/fsl_easrc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index b7a429170794f..1765e46ba5a47 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -2386,7 +2386,6 @@ static int fsl_easrc_runtime_resume(struct device *dev)
 	scoped_guard(spinlock_irqsave, &easrc->lock) {
 		if (easrc_priv->firmware_loaded)
 			return 0;
-		easrc_priv->firmware_loaded = 1;
 	}
 
 	ret = fsl_easrc_get_firmware(easrc);
@@ -2435,6 +2434,9 @@ static int fsl_easrc_runtime_resume(struct device *dev)
 			goto disable_mem_clk;
 	}
 
+	scoped_guard(spinlock_irqsave, &easrc->lock)
+		easrc_priv->firmware_loaded = 1;
+
 	return 0;
 disable_mem_clk:
 	clk_disable_unprepare(easrc->mem_clk);
-- 
2.43.0


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

end of thread, other threads:[~2026-12-01 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 14:33 [PATCH] ASoC: fsl_easrc: Set firmware_loaded only after a successful resume HyeongJun An
2026-12-01 14:48 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.