summary refs log tree commit diff
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-04-19 11:02:29 +0900
committerMark Brown <broonie@kernel.org>2021-04-20 17:25:46 +0100
commit6769ea1e4315999624ce4637c9c338b9d88a85e6 (patch)
tree9386bf1756f30f0d0fb4e618b88662bd22019276 /sound
parentf6fcc820e0c96664e2f21c0d6bb60630243ef36a (diff)
downloadlinux-6769ea1e4315999624ce4637c9c338b9d88a85e6.tar.gz
ASoC: audio-graph: check ports if exists
"endpoint" and "port" are always exists, but there is no guarantee
for "ports". This patch checks "ports" if exists, otherwise,
it might set un-expected settings.

This patch also do align to 100 char in 1 line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wnsz3ubu.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/audio-graph-card.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 976c1ea31a98..f3c278a4be21 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -182,7 +182,8 @@ static void graph_parse_convert(struct device *dev,
 
 	asoc_simple_parse_convert(top,   NULL,   adata);
 	asoc_simple_parse_convert(node,  PREFIX, adata);
-	asoc_simple_parse_convert(ports, NULL,   adata);
+	if (of_node_name_eq(ports, "ports"))
+		asoc_simple_parse_convert(ports, NULL, adata);
 	asoc_simple_parse_convert(port,  NULL,   adata);
 	asoc_simple_parse_convert(ep,    NULL,   adata);
 
@@ -200,7 +201,8 @@ static void graph_parse_mclk_fs(struct device_node *top,
 	struct device_node *node	= of_graph_get_port_parent(ep);
 
 	of_property_read_u32(top,	"mclk-fs", &props->mclk_fs);
-	of_property_read_u32(ports,	"mclk-fs", &props->mclk_fs);
+	if (of_node_name_eq(ports, "ports"))
+		of_property_read_u32(ports, "mclk-fs", &props->mclk_fs);
 	of_property_read_u32(port,	"mclk-fs", &props->mclk_fs);
 	of_property_read_u32(ep,	"mclk-fs", &props->mclk_fs);
 
@@ -311,8 +313,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 					      "prefix");
 		snd_soc_of_parse_node_prefix(node, cconf, codecs->of_node,
 					     PREFIX "prefix");
-		snd_soc_of_parse_node_prefix(ports, cconf, codecs->of_node,
-					     "prefix");
+		if (of_node_name_eq(ports, "ports"))
+			snd_soc_of_parse_node_prefix(ports, cconf, codecs->of_node, "prefix");
 		snd_soc_of_parse_node_prefix(port, cconf, codecs->of_node,
 					     "prefix");
 	}