Sound not working after commit bbf7d3b1c4f40eb02dd1dffb500ba00b0bff0303 on Amlogic A311D device

Takashi Iwai tiwai at suse.de
Tue Jul 12 11:29:53 CEST 2022


On Mon, 11 Jul 2022 16:33:14 +0200,
Pierre-Louis Bossart wrote:
> 
> 
> 
> On 7/9/22 06:19, Alex Natalsson wrote:
> >>> +       if (!fe_substream) {
> >>> +               dev_err(fe->dev, "%s: fe_substream not initialized\n",
> >>> __func__);
> >>> +               return -EINVAL;
> >>> +       }
> >>> +       if (!be_substream) {
> >>> +               dev_err(be->dev, "%s: be_substream not initialized\n",
> >>> __func__);
> >>> +               return -EINVAL;
> >>> +       }
> >>> +
> > 
> > Will be this in upstream or needing bugzilla reporting message?
> I created a patch based on this, see
> https://github.com/thesofproject/linux/pull/3735
> 
> I am not sure however if this is the 'right' fix. There was a comment
> from Peter Ujfalusi that a BE substream may be initialized later, but if
> that's the case then the atomicity check that was introduced is done in
> the wrong location.
> 
> Takashi, we could use your guidance here.

I guess that the check of fe_substream there is superfluous.  It must
be never NULL.  And, in principle, passing the invalid BE to this
function itself sounds already wrong.  That said, if any check is
needed, it should be done beforehand at choosing the right BE.

A fix like below might work instead?  (Totally untested)


thanks,

Takashi

-- 8< --
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1318,6 +1318,9 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
 		if (!be->dai_link->no_pcm)
 			continue;
 
+		if (!snd_soc_dpcm_get_substream(be, stream))
+			continue;
+
 		for_each_rtd_dais(be, i, dai) {
 			w = snd_soc_dai_get_widget(dai, stream);
 


More information about the Alsa-devel mailing list