From patchwork Wed May 24 10:28:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Scheel X-Patchwork-Id: 9745747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0294601C2 for ; Wed, 24 May 2017 10:37:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 918C728912 for ; Wed, 24 May 2017 10:37:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84CFF2894A; Wed, 24 May 2017 10:37:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D403028912 for ; Wed, 24 May 2017 10:37:32 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 30127267334; Wed, 24 May 2017 12:29:18 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8C1D2267335; Wed, 24 May 2017 12:29:16 +0200 (CEST) Received: from web01.jusst.de (jusst.de [188.40.114.84]) by alsa0.perex.cz (Postfix) with ESMTP id C4C90267333 for ; Wed, 24 May 2017 12:29:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by web01.jusst.de (Postfix) with ESMTP id 1F8611B01E80; Wed, 24 May 2017 12:29:14 +0200 (CEST) Authentication-Results: web01.jusst.de (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=jusst.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=jusst.de; h= x-mailer:message-id:date:date:subject:subject:from:from; s= default; t=1495621753; x=1497436154; bh=sYcPXsL6QIJ16azfiK9xkSlp eqyOzgRQ8Hv4utXw32k=; b=c0KUeBsEwnaHq26nif3iFTaTPAVj5bcf57yTe3T4 wO3Fh6zM4gCbZ81JM4GEoHoZYpk9VYxnbo1PU/Pm90aA2/JtP8ajIrT1vqsJK2Q5 NR8RoLEHsJORp7iSZABO+PyU+VS46OxXRxNQjSl/osHvsCls3E/ufSrfMmJQL6t5 wLg= X-Virus-Scanned: Debian amavisd-new at web01.jusst.de Received: from web01.jusst.de ([127.0.0.1]) by localhost (web01.jusst.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zojGKFyYufy3; Wed, 24 May 2017 12:29:13 +0200 (CEST) Received: from julian-macbook.net.jusst.de (unknown [87.253.171.135]) (Authenticated sender: julian@jusst.de) by web01.jusst.de (Postfix) with ESMTPSA id 5B6D41B01E31; Wed, 24 May 2017 12:29:13 +0200 (CEST) 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 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 Cc: Julian Scheel Subject: [alsa-devel] [PATCH] ASoC: simple-card: Fix misleading error message X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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;