Re: [PATCH v1] ASoC: qcom: qdsp6: Fix q6apm remove ordering during ADSP stop and start

From: Srinivas Kandagatla

Date: Wed Mar 04 2026 - 08:18:42 EST


Thanks Ravi for fixing this,
On 2/27/26 2:45 PM, Ravi Hothi wrote:
> During ADSP stop and start, the kernel crashes due to the order in which
> ASoC components are removed.
>
> On ADSP stop, the q6apm-audio .remove callback unloads topology and removes
> PCM runtimes during ASoC teardown. This deletes the RTDs that contain the
> q6apm DAI components before their removal pass runs, leaving those
> components still linked to the card and causing crashes on the next rebind.
>
> Fix this by ensuring that all dependent (child) components are removed
> first, and the q6apm component is removed last.
>
> [ 48.105720] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000d0
> [ 48.114763] Mem abort info:...
...
this has been an issue for a long time, hopefully with this patch, we
can get the card rebind working audioreach with all the lpass codecs.

> Fixes: 5477518b8a0e ("ASoC: qdsp6: audioreach: add q6apm support")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Ravi Hothi <ravi.hothi@xxxxxxxxxxxxxxxx>

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>

--srini
> ---
> sound/soc/qcom/qdsp6/q6apm-dai.c | 1 +
> sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 1 +
> sound/soc/qcom/qdsp6/q6apm.c | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
> index de3bdac3e791..168c166c960d 100644
> --- a/sound/soc/qcom/qdsp6/q6apm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
> @@ -838,6 +838,7 @@ static const struct snd_soc_component_driver q6apm_fe_dai_component = {
> .ack = q6apm_dai_ack,
> .compress_ops = &q6apm_dai_compress_ops,
> .use_dai_pcm_id = true,
> + .remove_order = SND_SOC_COMP_ORDER_EARLY,
> };
>
> static int q6apm_dai_probe(struct platform_device *pdev)
> diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
> index 528756f1332b..5be37eeea329 100644
> --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
> +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
> @@ -278,6 +278,7 @@ static const struct snd_soc_component_driver q6apm_lpass_dai_component = {
> .of_xlate_dai_name = q6dsp_audio_ports_of_xlate_dai_name,
> .be_pcm_base = AUDIOREACH_BE_PCM_BASE,
> .use_dai_pcm_id = true,
> + .remove_order = SND_SOC_COMP_ORDER_FIRST,
> };
>
> static int q6apm_lpass_dai_dev_probe(struct platform_device *pdev)
> diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c
> index 44841fde3856..970b08c89bb3 100644
> --- a/sound/soc/qcom/qdsp6/q6apm.c
> +++ b/sound/soc/qcom/qdsp6/q6apm.c
> @@ -715,6 +715,7 @@ static const struct snd_soc_component_driver q6apm_audio_component = {
> .name = APM_AUDIO_DRV_NAME,
> .probe = q6apm_audio_probe,
> .remove = q6apm_audio_remove,
> + .remove_order = SND_SOC_COMP_ORDER_LAST,
> };
>
> static int apm_probe(gpr_device_t *gdev)