From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E0783815D1; Thu, 19 Mar 2026 06:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773903483; cv=none; b=J2KtncF4hEMdTwwz/PbVActiSFL4UJ/9eSgI8NxgBEy5+an6Zu3wCHSKtXi/qn4gb24T+Tmb1G/C+U/aF6DrLRaTYHEL0RdIMW3excQ45ixJ8JqzQarvT8f08eQ7rzMoq2qMNou52GErYxN1hP5e/nhGM+6grkzS14yl0AWEXyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773903483; c=relaxed/simple; bh=t8hT6mWpjp3vxM3muTEUoLbjhCO2cMgThzalJCWlfIE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NuvQFF0fh/ARzzNOUeQtrm340SjUonaLEGTEuvBsVDTfbdNK+fYZGnAMTc8RrvZQd9dLBjf9T9ZykMldpdlUu5ll93CJzXgUypcU3NeADxnhFlbyG4vvvceKwPk0JrQw+/iIg6PEa97IX9kgduGSnc9U9Bvr/rLErP46ZF7jaLA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=e3yAn5zI; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="e3yAn5zI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773903482; x=1805439482; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=t8hT6mWpjp3vxM3muTEUoLbjhCO2cMgThzalJCWlfIE=; b=e3yAn5zIaOf0Zc1+ONt6TQInBJCO9uoU4+G8OThSww5bQS1Cl8HE5QQm wCTUy87dAYjKJDafQv3LK7J+Yo5TkHPjPGsycqLlKn04dxTgaA//RFgiO 1NhG61tn729S0PqaSs/+9pnRtm9MrvHfkxnQg2a6Rvi/0fw1kwpSvtK0p Jpb4G4lNATO3ZGg9iEbWr9lKuTaEgb4cN3apWmL2K7dB3Wi8T3qKl6EKp nAyqhuXlY04p5T9eRunM3EU1S7C/u5GFMVhr9HQdoPetj3CgeZYWMq1vi uRWYOD3FgQD6Z6zPu+m+w9Wc+u+uFVNqIDy5ADVnmGUdC7M5iwnED8Eap g==; X-CSE-ConnectionGUID: Z4yx4w4+RteGc3kSzyfxiw== X-CSE-MsgGUID: q0r3m7c5SyKH9dQKUAufcA== X-IronPort-AV: E=McAfee;i="6800,10657,11733"; a="85671616" X-IronPort-AV: E=Sophos;i="6.23,128,1770624000"; d="scan'208";a="85671616" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2026 23:58:02 -0700 X-CSE-ConnectionGUID: o0SYFqfeSlqpnE1pq/27Zw== X-CSE-MsgGUID: XX51E6SfRoWjAhz53NIXvg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,128,1770624000"; d="scan'208";a="218813473" Received: from klitkey1-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.244.120]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2026 23:58:00 -0700 Date: Thu, 19 Mar 2026 08:57:58 +0200 From: Andy Shevchenko To: Mika Westerberg Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , Linus Walleij Subject: Re: [PATCH v1 5/5] pinctrl: intel: define iterator variables inside for-loop Message-ID: References: <20260318151256.2590375-1-andriy.shevchenko@linux.intel.com> <20260318151256.2590375-6-andriy.shevchenko@linux.intel.com> <20260319060221.GP2275908@black.igk.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260319060221.GP2275908@black.igk.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Thu, Mar 19, 2026 at 07:02:21AM +0100, Mika Westerberg wrote: > On Wed, Mar 18, 2026 at 04:10:19PM +0100, Andy Shevchenko wrote: > > Reduce the scope of the iterator variables by defining them inside > > the respective for-loops. This makes code more robust against reuse > > of the same variable in the future, which might lead to some mistakes. ... > > - int i; > > If there are multiple loops, I prefer to declare the variable outside of > them. Why?! It's exactly where it make even more sense to hide. > If it is just a single loop then for (int i = 0, ..) is fine. ... > > - for (i = 0; i < grp->grp.npins; i++) { > > + for (unsigned int i = 0; i < grp->grp.npins; i++) { > > also why you use "unsigned int". int i is fine here. Because grp.npins is unsigned. This is the common sense to use the same variable type that's used for the (upper) limit. > > } -- With Best Regards, Andy Shevchenko