Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2761065imu; Sat, 10 Nov 2018 23:57:05 -0800 (PST) X-Google-Smtp-Source: AJdET5d/098joZQfXRPJzivr2coae1Hht/nNZw1xQU0yCv5lwu+nFD5q0lOH6M+2eCQ3zb1D0xyS X-Received: by 2002:a17:902:29e3:: with SMTP id h90-v6mr15657543plb.158.1541923025314; Sat, 10 Nov 2018 23:57:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541923025; cv=none; d=google.com; s=arc-20160816; b=uUZIZ7QaNbw4gtXlvNDVwo2kD7tmYuQt9ejPTUbKjwyCTzcKuYGwdK12XP/CozQeIO Kg796H96+yQeRBMEpBpSB4z/H/MtMFuOBJgdOC4Y3FQ+zdGyW70GgOrmzAse4fUsnqcZ cuFWffIp1jXgJPCUpLwxs/oB99lNy8SnUVyQNK7pYWJaT+vNlIK+mUYjgXc76Un3dKeO LHRdT8q4zONT+PcRT0g4UTpwSniF3kk1gXofV/Z2YOb9B3Ha+gN+lcitZVBtrtNtLWDo Ej9tmpCa5SqMn4nod2ZWTaxQ1iJ3bBvJFeqcWKjzgvM/epos0Zf77UUCfyYqSXk1cFTj 2bpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FeefSBmW6qU7F0pHDfhAGdcBWTAzDMXfpuYC1k6Z4Go=; b=m5eyGMEXKsjQHwUz13myLDXNMOykx/Kcn91djOnllgpYojw9aJsMmd3sMcspSHIagY kXh0Z7nuNr3DQ1bUluoislV0tN/Ujq4adSMFyMpmphBZxdgvnaHNn7NkNoFh1CCE9qCd zO59SIWDrmkdGl/YY2RulSpVM/iNcq2U/V7/056bbHkyN6YYCltdRc32AiCytdfJqfmS 4a25mG10SPQqretz4rMl4SIUtUDZlTfrUnB6gvyii21IiHr0aLnx1UfDaJPds7MEYFtr 8U1EAhPjqVQYglOL2rk9f4EA5Bk9lHt04V8KSWtEGCCzTShCzrhFokMIO1Y774jkHJxR tTgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FeVdD4Es; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8-v6si15163531pln.368.2018.11.10.23.56.14; Sat, 10 Nov 2018 23:57:05 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FeVdD4Es; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727427AbeKKRnO (ORCPT + 99 others); Sun, 11 Nov 2018 12:43:14 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:33118 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727055AbeKKRnO (ORCPT ); Sun, 11 Nov 2018 12:43:14 -0500 Received: by mail-wm1-f68.google.com with SMTP id f19-v6so6621869wmb.0; Sat, 10 Nov 2018 23:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FeefSBmW6qU7F0pHDfhAGdcBWTAzDMXfpuYC1k6Z4Go=; b=FeVdD4EsZHdzWgQRwn0DaEHgIyf+4nDiOM28aHYFZ7/4FMhtZtRNrd0xtYqyC8V2wK 0clq8Vru9r3Zyqf5q9/o/rt2aXWxn86hi8m3kK8jPfuLjPcUDzbysx/y7CyHMpMASOLa Si0i4CD1egcuhOL7YjGGRCaytRtFX1xDMSIo3p/4HygGPHFtDp8RFMA94JZm4LpRe2QD kc3T7JdqlMktPhL8vtATBNgcEpED4g/ZkaMYxCwsrQz/Br8+sT1RbykV5fHVwplABMry QFnJVnfwHKayf+u3Ws0TiNbM+fSAD8i9e77tQ6aziXkO+D/byD4xOREvlAK/ev0T6AT/ jFkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FeefSBmW6qU7F0pHDfhAGdcBWTAzDMXfpuYC1k6Z4Go=; b=qG0j015k64uKyCURXBElIiOKcPixLs/Izv7p9VvGRJuKU6D40cWYklnYjopBm3g3Lk od2Y2+6dXZyaowCtItkfB1AnPNKrx++641OAuuY4Bgzvyu15U7QwpKEGAz5Iv61VsRaM oX5n63nAYc9biL0EF1cvtf9VaOkqXOdIy13Q0FlRSPDM96XYRLdY7MRPubsiKLRB6f7p rVnL/z0ToJmzrByPdGSatewoq1KET6JWE+XW7VIy4Oo4+1zS6fWxF1GdRXPBvvIqGopD PwQNUmMyOaYZPExjlI85UMFvlSHhv6i6AsDAJdfOxKrTcWllvwK0LTvppjyUBxTgxCkN 2eQQ== X-Gm-Message-State: AGRZ1gIyimVSQ3Cggp+Q1UJ1v5E7kxwj6JnvxxD98EbZIetesMxwlGZZ b7U0S4Ak6YhdvtBR1byjaT0= X-Received: by 2002:a1c:c46:: with SMTP id 67-v6mr4284937wmm.6.1541922921816; Sat, 10 Nov 2018 23:55:21 -0800 (PST) Received: from camaron (211.red-88-7-211.staticip.rima-tde.net. [88.7.211.211]) by smtp.gmail.com with ESMTPSA id m13-v6sm14542073wrw.14.2018.11.10.23.55.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 23:55:20 -0800 (PST) Date: Sun, 11 Nov 2018 08:55:18 +0100 From: Sergio Paracuellos To: Colin King Cc: Greg Kroah-Hartman , John Crispin , devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: mt7621-pinctrl: fix uninitialized variable ngroups Message-ID: <20181111075518.GA23361@camaron> References: <20181110232806.14255-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181110232806.14255-1-colin.king@canonical.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 10, 2018 at 11:28:06PM +0000, Colin King wrote: > 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 > Thanks, Colin. Looks good. Reviewed-by: Sergio Paracuellos Best regards, Sergio Paracuellos