[alsa-devel] [PATCH v2 10/25] ASoC: soc-core: tidyup for snd_soc_add_card_controls()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Aug 7 03:31:08 CEST 2019


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

snd_soc_add_card_controls() registers controls by using
for(... i < num; ...). If controls was NULL, num should be zero.
Thus, we don't need to check about controls pointer.
This patch also cares missing return value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
v1 -> v2

	- check return value
	- change Subject

 sound/soc/soc-core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ca1b04c..e939544 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2057,9 +2057,10 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
 	snd_soc_dapm_link_dai_widgets(card);
 	snd_soc_dapm_connect_dai_link_widgets(card);
 
-	if (card->controls)
-		snd_soc_add_card_controls(card, card->controls,
-					  card->num_controls);
+	ret = snd_soc_add_card_controls(card, card->controls,
+					card->num_controls);
+	if (ret < 0)
+		goto probe_end;
 
 	ret = snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes,
 				      card->num_dapm_routes);
-- 
2.7.4



More information about the Alsa-devel mailing list