From: Kuninori Morimoto Date: Wed, 12 Feb 2025 02:29:03 +0000 (+0000) Subject: ASoC: soc-pcm: cleanup dpcm_dai_trigger_fe_be() X-Git-Tag: v6.15-rc1~173^2~4^2~108^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3aebbcba4baaa81bc8c83f2229ed8e774cf40618;p=thirdparty%2Fkernel%2Fstable.git ASoC: soc-pcm: cleanup dpcm_dai_trigger_fe_be() DPCM is already difficult to read, but now dpcm_dai_trigger_fe_be() even difficult to read. static int dpcm_dai_trigger_fe_be(.., fe_first) { ^ if (fe_first) { (A) ... |(x) goto end; v } ^ (B) ... v end: return ... } It want to switch function call order by using "fe_first" for fe->be order part (A), or be->fe order part (B). But the code is using "goto" in last of (A) (=x). Just use "if..else" for (A) (B) is easy to read and understand what it want to do. static int dpcm_dai_trigger_fe_be(.., fe_first) { ^ if (fe_first) { (A) ... v } ^ else { (B) ... v } return ... } Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87ikpfyjyo.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 96776824d9daa..8a3073a506aa2 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2365,18 +2365,18 @@ static int dpcm_dai_trigger_fe_be(struct snd_pcm_substream *substream, goto end; ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); - goto end; } - /* call trigger on the frontend after the backend. */ - ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); - if (ret < 0) - goto end; + else { + ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); + if (ret < 0) + goto end; - dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", - fe->dai_link->name, cmd); + dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", + fe->dai_link->name, cmd); - ret = soc_pcm_trigger(substream, cmd); + ret = soc_pcm_trigger(substream, cmd); + } end: return snd_soc_ret(fe->dev, ret, "trigger FE cmd: %d failed\n", cmd); }