Re: [PATCH] ASoC: atmel: mchp-pdmc: Skip ALSA restoration if substream runtime is uninitialized

From: Mark Brown
Date: Tue Sep 24 2024 - 05:00:11 EST


On Tue, Sep 24, 2024 at 11:12:38AM +0300, Andrei Simion wrote:

> Update the driver to prevent alsa-restore.service from failing when
> reading data from /var/lib/alsa/asound.state at boot. Ensure that the
> restoration of ALSA mixer configurations is skipped if substream->runtime
> is NULL.

> +++ b/sound/soc/atmel/mchp-pdmc.c
> @@ -302,6 +302,9 @@ static int mchp_pdmc_chmap_ctl_put(struct snd_kcontrol *kcontrol,
> if (!substream)
> return -ENODEV;
>
> + if (!substream->runtime)
> + return 0; /* just for avoiding error from alsactl restore */
> +

This then means that control writes are just discarded which presumably
is going to upset things if they actually saved a value here. Why is
that a good choice, rather than either fixing the race so the card
doesn't come up too early or removing the need for the runtime?

Attachment: signature.asc
Description: PGP signature