diff mbox series

[18/28] ASoC: soc-core: dai_link check under soc_dpcm_debugfs_add()

Message ID 87blx32if2.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: cleanup patches for soc-core | expand

Commit Message

Kuninori Morimoto Aug. 6, 2019, 1:30 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

soc_dpcm_debugfs_add(rtd) is checking rtd->dai_link pointer,
but, rtd->dai_link->dynamic have been already checked before calling it.

	static int soc_probe_link_dais(...) {
		dai_link = rtd->dai_link;
		...
=>		if (dai_link->dynamic)
=>			soc_dpcm_debugfs_add(rtd);
		...
	}

	void soc_dpcm_debugfs_add(rtd)
	{
=>		if (!rtd->dai_link)
			return;
		...
	}

These pointer checks are strange/pointless.
This patch checks dai_link->dynamic under soc_dpcm_debugfs_add().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c | 3 +--
 sound/soc/soc-pcm.c  | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 724e376..188b60c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1480,8 +1480,7 @@  static int soc_probe_link_dais(struct snd_soc_card *card,
 		return ret;
 
 	/* add DPCM sysfs entries */
-	if (dai_link->dynamic)
-		soc_dpcm_debugfs_add(rtd);
+	soc_dpcm_debugfs_add(rtd);
 
 	num = rtd->num;
 
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 77c986f..da657c8 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -3200,6 +3200,9 @@  void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd)
 	if (!rtd->dai_link)
 		return;
 
+	if (!rtd->dai_link->dynamic)
+		return;
+
 	if (!rtd->card->debugfs_card_root)
 		return;