Skip to content

Commit

Permalink
ASoC: simple-card: Fix misleading error message
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julian Scheel authored and Mark Brown committed May 24, 2017
1 parent 2ea659a commit 7ac45d1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sound/soc/generic/simple-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7ac45d1

Please sign in to comment.