From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939552AbdEXKkb (ORCPT ); Wed, 24 May 2017 06:40:31 -0400 Received: from jusst.de ([188.40.114.84]:41708 "EHLO web01.jusst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938755AbdEXKia (ORCPT ); Wed, 24 May 2017 06:38:30 -0400 X-Greylist: delayed 536 seconds by postgrey-1.27 at vger.kernel.org; Wed, 24 May 2017 06:38:30 EDT Authentication-Results: web01.jusst.de (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=jusst.de From: Julian Scheel To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , Nikita Yushchenko , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Julian Scheel Subject: [PATCH] ASoC: simple-card: Fix misleading error message Date: Wed, 24 May 2017 12:28:23 +0200 Message-Id: <20170524102823.8253-1-julian@jusst.de> X-Mailer: git-send-email 2.12.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- sound/soc/generic/simple-card.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 7ed84f811205..38d7b601546f 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -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; -- 2.12.2