Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2455303imu; Sat, 10 Nov 2018 15:28:45 -0800 (PST) X-Google-Smtp-Source: AJdET5dHn4QB1kLzTc0FVrQCFaFpjYTvB3YnX7aO6ukb45Yos5spcvnkWaUbv47KPlPGIdVPt78g X-Received: by 2002:a62:cfc1:: with SMTP id b184-v6mr14430547pfg.162.1541892525283; Sat, 10 Nov 2018 15:28:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541892525; cv=none; d=google.com; s=arc-20160816; b=jZTWJzfpeSvyCYVVP79zp1hOrmWmfzvIVp+hr8mBry5UFoKm/2ik660hf8kO6WnXRe 0hLHxsmj09q9Kcp3e0QV/DwvQaAme24cjV4DCwlwdHtLoZk2VpgzRUtwn6tE0CU1zf3y P8KqfZhXW68FBja8HKbzraZiT7fDqvIV97LoWay6PjZOOIRB0axc4lODxCuXgA+F9lFk w/7BZO+v2XXzRSwi1JGgzOfw195uW8CZL+iyNh8tLy6WMidLJkhVstOqyuFDl/4kvFmK P989FotJCtXgJgLfbsmKvW1sAuOSlroW/sZnJg4RiZr/XR/vIB0MFN/D6SvyT7qTFA67 9XNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=t2oZoIKR9lqPgrW9LlVF2uEw2OtRHoG6HtZRt8Zkn+0=; b=YESzhttNxuAujbkEcKQv4BWwQh0wdvCseWmRP710PJlZvCGsY91BrAuq+EY+phSnHF aKWe7IY/Za9e4C4Bh0Gn1dH+T/nsfjHCwRvKsyWta76jdiz26WxATfb97yMtJxx2wLC4 kNvwjTE4xzvUnMDsJ43IqEqOhki6KtovRThGq2KrwbqzKFIRyiABFMXZl/gxLHzNMQ0t xP1PnMxmfi1mVOD3UaAls97F2QoUZJFyYmtnFbeg95KmGNIu0NfLqdOnoFsFWQSJAP+x OorbntFrfrpzW59XV3l+pW8uX0n841USk2Jg77MhQ3yP/2RJPPegjY2BOfibchQbTZWU 0wMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63-v6si13759479pfg.234.2018.11.10.15.28.29; Sat, 10 Nov 2018 15:28:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbeKKJOu (ORCPT + 99 others); Sun, 11 Nov 2018 04:14:50 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:51650 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbeKKJOu (ORCPT ); Sun, 11 Nov 2018 04:14:50 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gLcff-0005NY-2D; Sat, 10 Nov 2018 23:28:07 +0000 From: Colin King To: Greg Kroah-Hartman , Sergio Paracuellos , John Crispin , devel@driverdev.osuosl.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: mt7621-pinctrl: fix uninitialized variable ngroups Date: Sat, 10 Nov 2018 23:28:06 +0000 Message-Id: <20181110232806.14255-1-colin.king@canonical.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently the for_each_node_with_property loop us incrementing variable ngroups however it was not initialized and hence will contain garbage. Fix this by initializing ngroups to zero. Detected with static analysis with cppcheck: drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c:89]: (error) Uninitialized variable: ngroups Fixes: e12a1a6e087b ("staging: mt7621-pinctrl: refactor rt2880_pinctrl_dt_node_to_map function") Signed-off-by: Colin Ian King --- drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c index b8566ed898f1..aa98fbb17013 100644 --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c @@ -82,7 +82,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev, struct property *prop; const char *function_name, *group_name; int ret; - int ngroups; + int ngroups = 0; unsigned int reserved_maps = 0; for_each_node_with_property(np_config, "group") -- 2.19.1