From patchwork Tue Dec 1 08:59:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7733931 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ACBA39F30B for ; Tue, 1 Dec 2015 09:00:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1321206A4 for ; Tue, 1 Dec 2015 09:00:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id ABCC7206A9 for ; Tue, 1 Dec 2015 09:00:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EFD44265A86; Tue, 1 Dec 2015 10:00:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2102A265A2A; Tue, 1 Dec 2015 09:59:54 +0100 (CET) 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 0AFDF265A2D; Tue, 1 Dec 2015 09:59:53 +0100 (CET) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by alsa0.perex.cz (Postfix) with ESMTP id 9ED122659E2 for ; Tue, 1 Dec 2015 09:59:45 +0100 (CET) Received: by pacej9 with SMTP id ej9so215549527pac.2 for ; Tue, 01 Dec 2015 00:59:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=3pdcM4eqk9jvDrFdrGDWISAafvTMxuIJOm2MSUPlSFA=; b=HXQPv2GLRg9Q2GrnTIdotLhl0eDr4m47mu++Y3stGzRqpaKY4+8GIH8cBZkWbR7rhk +sOl/mczUzk0sJ+p4mlkokr+DXQbORS7dcrImWTBF/bgCTKCY1Giku6z4VIeyGHfJbkh kGvTQDnEtccdr0DripoU0IzNZ9yPsiSVgBTqxGOiR31YawelZQAeOIjTJmBtIexjeMUG GR3zw6WxOiILMVQnEwtLY5aHhvbrb8F9d8wkUtqemjT8x3/BVNpoNCC1Tv4C+kTp3EDa uWVueM8/FjmL27LdnRE6NeIBhojgyJaC1OrS5PU0z0lRZMant5VSirYmHq7AbKSo68wm HC8w== X-Received: by 10.67.5.98 with SMTP id cl2mr12542582pad.157.1448960384321; Tue, 01 Dec 2015 00:59:44 -0800 (PST) Received: from sudip-pc.vectortproxy.org ([122.169.145.251]) by smtp.gmail.com with ESMTPSA id v89sm40156340pfa.91.2015.12.01.00.59.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Dec 2015 00:59:43 -0800 (PST) From: Sudip Mukherjee To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Date: Tue, 1 Dec 2015 14:29:35 +0530 Message-Id: <1448960375-9710-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Sudip Mukherjee Subject: [alsa-devel] [PATCH v3] ASoC: hdac_hdmi: check error return 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 As hdac->num_nodes is unsigned we can not check if snd_hdac_get_sub_nodes() has returned error or success. Lets have a temporary int to check the error value. Signed-off-by: Sudip Mukherjee --- v2: made num_nodes as int, but Takashi said that num_nodes should really be an unsigned. v1: removed the error check as that condition is always false. sound/soc/codecs/hdac_hdmi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 205f2c2..1a2f33b 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -409,17 +409,18 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev, static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev) { hda_nid_t nid; - int i; + int i, num_nodes; struct hdac_device *hdac = &edev->hdac; struct hdac_hdmi_priv *hdmi = edev->private_data; int cvt_nid = 0, pin_nid = 0; - hdac->num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid); - if (!nid || hdac->num_nodes < 0) { + num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid); + if (!nid || num_nodes < 0) { dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n"); return -EINVAL; } + hdac->num_nodes = num_nodes; hdac->start_nid = nid; for (i = 0; i < hdac->num_nodes; i++, nid++) {