ASoC: core: Fix the DAI name getting.
authorXiubo Li <Li.Xiubo@freescale.com>
Fri, 20 Dec 2013 06:39:51 +0000 (14:39 +0800)
committerMark Brown <broonie@linaro.org>
Tue, 31 Dec 2013 16:27:44 +0000 (16:27 +0000)
From "ASoC: make snd_soc_dai_link more symmetrical", can we see that
the name of CPU DAI maybe omitted. If the DAI name is omitted, try to
use the component name instead.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/soc-core.c

index 4e53d87e881d0891a3d8437881d12d41225303cc..03c779ebd729336ad384f100fc858c2f1126ce29 100644 (file)
@@ -4617,10 +4617,14 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
 
                        if (id < 0 || id >= pos->num_dai) {
                                ret = -EINVAL;
-                       } else {
-                               *dai_name = pos->dai_drv[id].name;
-                               ret = 0;
+                               break;
                        }
+
+                       ret = 0;
+
+                       *dai_name = pos->dai_drv[id].name;
+                       if (!*dai_name)
+                               *dai_name = pos->name;
                }
 
                break;