From patchwork Thu Dec 3 21:08:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Subhransu S. Prusty" X-Patchwork-Id: 7761031 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C27ACBEEE1 for ; Thu, 3 Dec 2015 15:38:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D65DC2054C for ; Thu, 3 Dec 2015 15:38:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id AA1B220551 for ; Thu, 3 Dec 2015 15:38:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 752E1260522; Thu, 3 Dec 2015 16:38:32 +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=0.4 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_03_06, RCVD_IN_DNSWL_LOW,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id EF56926047F; Thu, 3 Dec 2015 16:38:29 +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 0D1AE26047F; Thu, 3 Dec 2015 16:38:29 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by alsa0.perex.cz (Postfix) with ESMTP id CE730260429 for ; Thu, 3 Dec 2015 16:38:21 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 03 Dec 2015 07:38:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,378,1444719600"; d="scan'208";a="611962797" Received: from subhransu-desktop.iind.intel.com ([10.223.96.57]) by FMSMGA003.fm.intel.com with ESMTP; 03 Dec 2015 07:38:17 -0800 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Fri, 4 Dec 2015 02:38:49 +0530 Message-Id: <1449176942-3441-1-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449176538-3250-1-git-send-email-subhransu.s.prusty@intel.com> References: <1449176538-3250-1-git-send-email-subhransu.s.prusty@intel.com> Cc: tiwai@suse.de, David Airlie , lgirdwood@gmail.com, dri-devel@lists.freedesktop.org, patches.audio@intel.com, broonie@kernel.org, Daniel Vetter , Vinod Koul , "Subhransu S. Prusty" , Dan Carpenter Subject: [alsa-devel] [PATCH v2 01/14] ASoC: hdac_hdmi: Fix to check num nodes correctly 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 commit 3c83ac23253c ("ASoC: hdac_hdmi: check error return") fixes the static checker warning reported by Dan Carpenter: sound/soc/codecs/hdac_hdmi.c:416 hdac_hdmi_parse_and_map_nid() warn: unsigned 'hdac->num_nodes' is never less than zero. But it doesn't fix the issue completely. It's also a failure if no sub nodes found for an afg node. So modify the return condition appropriately. Cc: Dan Carpenter Signed-off-by: Subhransu S. Prusty Signed-off-by: Vinod Koul --- sound/soc/codecs/hdac_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 1a2f33b..929f27b 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -415,7 +415,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev) int cvt_nid = 0, pin_nid = 0; num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid); - if (!nid || num_nodes < 0) { + if (!nid || num_nodes <= 0) { dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n"); return -EINVAL; }