ASoC: simple-card: Fix misleading error message
authorJulian Scheel <julian@jusst.de>
Wed, 24 May 2017 10:28:23 +0000 (12:28 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 24 May 2017 16:43:21 +0000 (17:43 +0100)
In case cpu could not be found the error message would always refer to
/codec/ not being found in DT. Fix this by catching the cpu node not found
case explicitly.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/simple-card.c

index 2c9deda..565d057 100644 (file)
@@ -233,13 +233,19 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
        snprintf(prop, sizeof(prop), "%scpu", prefix);
        cpu = of_get_child_by_name(node, prop);
 
+       if (!cpu) {
+               ret = -EINVAL;
+               dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
+               goto dai_link_of_err;
+       }
+
        snprintf(prop, sizeof(prop), "%splat", prefix);
        plat = of_get_child_by_name(node, prop);
 
        snprintf(prop, sizeof(prop), "%scodec", prefix);
        codec = of_get_child_by_name(node, prop);
 
-       if (!cpu || !codec) {
+       if (!codec) {
                ret = -EINVAL;
                dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
                goto dai_link_of_err;