diff mbox series

[v2,4/6] ASoC: topology: Check soc_tplg_add_route return value

Message ID 20200327204729.397-5-amadeuszx.slawinski@linux.intel.com (mailing list archive)
State Accepted
Commit 6856e887eae3efc0fe56899cb3f969fe063171c5
Headers show
Series ASoC: topology: Propagate error appropriately | expand

Commit Message

Amadeusz Sławiński March 27, 2020, 8:47 p.m. UTC
Function soc_tplg_add_route can propagate error code from callback, we
should check its return value and handle fail in correct way.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---

 v2:
  Added this patch

 sound/soc/soc-topology.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 860bced933d6..78d10b9b725b 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1284,7 +1284,9 @@  static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
 		routes[i]->dobj.index = tplg->index;
 		list_add(&routes[i]->dobj.list, &tplg->comp->dobj_list);
 
-		soc_tplg_add_route(tplg, routes[i]);
+		ret = soc_tplg_add_route(tplg, routes[i]);
+		if (ret < 0)
+			break;
 
 		/* add route, but keep going if some fail */
 		snd_soc_dapm_add_routes(dapm, routes[i], 1);