[alsa-devel] [PATCH 4/7] ASoC: soc-pcm: goto error after trying for_each_rtd_codec_dai

Takashi Iwai tiwai at suse.de
Tue Jan 28 17:44:15 CET 2020


On Tue, 28 Jan 2020 17:31:05 +0100,
Pierre-Louis Bossart wrote:
> 
> 
> 
> >>> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> >>>
> >>> soc_pcm_open() might goto error process *during* for_each_rtd_codec_dai.
> >>> In such case, fallback process need to care about operated/non-operated
> >>> codec dai.
> >>>
> >>> But, if it goto error process *after* loop even though error happen
> >>> during loop, it don't need to care about operated/non-operated.
> >>> In such case code can be more simple.
> >>> This patch do it. And this is prepare for soc_snd_open() cleanup
> >>
> >> This would mean that snd_soc_dai_shutdown() is called even for the
> >> stream that returned the error.  This isn't the expected behavior.
> >
> > Yeah.
> > Actually, I have plan to add such flag by other patch.
> > But indeed order was reversed.
> > Will fixup.
> >
> >> Also, bit-OR-ing the multiple error codes isn't wise, they may return
> >> different error codes, and you'll mixed up to a different number.
> >
> > It is used at some architecture.
> > But yes, let's think about better idea.
> > Will return 1st error.
> 
> I also cringed on the bit-OR'ed error codes, but I saw it's already
> used in soc-pcm.c so thought it was an agreed precedent?
> 
> 		ret |= snd_soc_component_close(component, substream);
> 		ret |= snd_soc_component_hw_free(component, substream);

I think it's just an overlook.  The driver may return arbitrary error
codes so they can conflict.  The bit-OR works only if the return code
is always consistent.


Takashi


More information about the Alsa-devel mailing list