diff mbox series

[11/12] ASoC: soc-pcm: cleanup dpcm_dai_trigger_fe_be()

Message ID 87ikpfyjyo.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State Accepted
Commit 3aebbcba4baaa81bc8c83f2229ed8e774cf40618
Headers show
Series ASoC: random cleanup | expand

Commit Message

Kuninori Morimoto Feb. 12, 2025, 2:29 a.m. UTC
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 <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

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);
 }