From nobody Thu Nov 28 22:38:05 2024 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2173B26296; Thu, 26 Sep 2024 14:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727359876; cv=none; b=f+5HPd0UxJxwVAux/lfSKzJFsjjTFhRIz+Sw1w0AWB9MAN82HugmKL1yQWENikAL+3XyEh+6fNcK4Hyu7595h8lX0MLtT+asGubs1y+7Duei6gR3RReK68ui6/dm8t8M8ICRNJjd9c2Q8QQvKxYhw/VJQyyZ4Q0WpBFgDnR4w4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727359876; c=relaxed/simple; bh=3NBSLNAD/+ojKnJ5pQmRk9ldNBXAqFRP1dQG8BuQ8kI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ywpbhbzc+hECtiq9kZMCQI80BrObE/VXz1cah7WMz4i9HmtsMUhetmcd+zitOiwlu+GHAgwfaQSJDqR3L6C3ImlEMfek1clMPna4BaLJPyJWihFNWq1xUrAEdOY/Nv+BKauw3xKrAdG6NFB22J3amTQKsXM8Nz2N+DQW6FHeZVs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EbC2cbbP; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EbC2cbbP" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2f8ca33ef19so14344791fa.2; Thu, 26 Sep 2024 07:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727359873; x=1727964673; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EG/C0RZisI0kve4A+qyt5M04d7snwIymh4dP7TfgG14=; b=EbC2cbbPOUoJUBBtxJFx8Y2Ij1Eq27LKYhloKlG53k55pIymWuQPA5YcT0bLD4FaKp +VeNRCEDoKxPVamWLMtvNzKI2bRCXR6bXcCkP+6G0HOJfLVqa9/vwEZeR39lvZhC1O4N fwtJ1P6ijjDddzPXSjPkK1FV9svqnJKRHEQ9bbUBi/urOpSDrGZG0YqAJVXEHrybHFrg vFtNapaSn37RWpJXT1wD08c51uKT6OCyfBlzYo4GJ1zRQs3AZ4SlqGa69Pqdj/iS++88 GLYDqF8cA5XhtF4qB8//DrXeD2lXIA4w0Odk8NdcGoqS062l4Y7f7afi5DFTQ+o7PnzS 2yIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727359873; x=1727964673; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EG/C0RZisI0kve4A+qyt5M04d7snwIymh4dP7TfgG14=; b=Nuf5lwik4q2ncb2jIHqD96CobR19+Lus1v9A+qF30Iuxed/0l+dl8jysNiS5gLP/PC Y/nQirBO0KxW10vmWEeMRc9tOMgoCFEFROijP0KZyFHbGY4IVxLw0cutGxFv7TQV0p+c f6+opF9VImxuYNtCYflZAU+8HYRwUW4pVP34E0CR4TIZ1i5sQD1rJVPuU4dSUwsGer83 j/kndAqeB+WWhYWJZIVg6yD4TORmzT1xM7Ji+UNIPmSlOiuL7JlciD9YFb6JXoSal73O BhyLJJwyjKEEiIs+V7I1KCijeyQJKAT8tCsCqoZ4zV133WvCU6S7lLNdP0C28mkOgHTL l1LA== X-Forwarded-Encrypted: i=1; AJvYcCWHeo9e0WRKkUPfI+GaXRvMKU3WY0YcF9f/VcMOZY3bigvV2180PpPJCVrIzW5FI5khh3QkQp1w@vger.kernel.org, AJvYcCWt1M4Pft6fyd2yIXx7IayDlz60HopKFrgI6RYKpnl1gT2l8K4yFeB2I8YmlPr3Ev925HSKM83+pLnQtcBr@vger.kernel.org, AJvYcCXy2t/uI/qNr2Vt+kFE3q0AELwBW3qJBLQB75+WxZmAkCSZSIoMruzd5SMegIBmF8Al5PneActdVgmd@vger.kernel.org X-Gm-Message-State: AOJu0YzyKKFw3/1g+ldZoaGRmZz0882sScspzgIq9NQE5aLy2mwjXxhn rmnEiftqiHLKdVWCyxq0sw1pCVHaKgKLtuxFEEwwDVOOBk/9EyBR X-Google-Smtp-Source: AGHT+IG9SmnyKcHgvqYpMAp/EjtBHQMErDyxgQ1ZeOAEppnV5SKOoxwSn1V72l8GXYGKnb5gRVE6Lg== X-Received: by 2002:a05:651c:2126:b0:2f7:94d9:426a with SMTP id 38308e7fff4ca-2f91507e2fdmr66456391fa.5.1727359872854; Thu, 26 Sep 2024 07:11:12 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-4e5f-6907-08e4-04ed.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:4e5f:6907:8e4:4ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27776cesm2498866b.40.2024.09.26.07.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 07:11:12 -0700 (PDT) From: Javier Carrasco Date: Thu, 26 Sep 2024 16:11:02 +0200 Subject: [PATCH 1/2] pinctrl: intel: platform: fix error path in device_for_each_child_node() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240926-intel-pinctrl-platform-scoped-v1-1-5ee4c936eea3@gmail.com> References: <20240926-intel-pinctrl-platform-scoped-v1-0-5ee4c936eea3@gmail.com> In-Reply-To: <20240926-intel-pinctrl-platform-scoped-v1-0-5ee4c936eea3@gmail.com> To: Mika Westerberg , Andy Shevchenko , Linus Walleij Cc: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco , stable@vger.kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727359869; l=1737; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=3NBSLNAD/+ojKnJ5pQmRk9ldNBXAqFRP1dQG8BuQ8kI=; b=ANAJduCwLj7wrhGnQqFzOnJ8YgpqYLUTWFKuP8lWpi0Q5NmIWSBiNVy6U7C6f68rx2CMe9M7+ CmPNDYY4HHgC9kiW0bUZhs7FyUIe5rYi5lSkPy1LGKpszSQzrmJaxB8 X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= The device_for_each_child_node() loop requires calls to fwnode_handle_put() upon early returns to decrement the refcount of the child node and avoid leaking memory if that error path is triggered. There is one early returns within that loop in intel_platform_pinctrl_prepare_community(), but fwnode_handle_put() is missing. Instead of adding the missing call, the scoped version of the loop can be used to simplify the code and avoid mistakes in the future if new early returns are added, as the child node is only used for parsing, and it is never assigned. Cc: stable@vger.kernel.org Fixes: c5860e4a2737 ("pinctrl: intel: Add a generic Intel pin control platf= orm driver") Signed-off-by: Javier Carrasco Acked-by: Mika Westerberg --- drivers/pinctrl/intel/pinctrl-intel-platform.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel-platform.c b/drivers/pinct= rl/intel/pinctrl-intel-platform.c index 4a19ab3b4ba7..2d5ba8278fb9 100644 --- a/drivers/pinctrl/intel/pinctrl-intel-platform.c +++ b/drivers/pinctrl/intel/pinctrl-intel-platform.c @@ -90,7 +90,6 @@ static int intel_platform_pinctrl_prepare_community(struc= t device *dev, struct intel_community *community, struct intel_platform_pins *pins) { - struct fwnode_handle *child; struct intel_padgroup *gpps; unsigned int group; size_t ngpps; @@ -131,7 +130,7 @@ static int intel_platform_pinctrl_prepare_community(str= uct device *dev, return -ENOMEM; =20 group =3D 0; - device_for_each_child_node(dev, child) { + device_for_each_child_node_scoped(dev, child) { struct intel_padgroup *gpp =3D &gpps[group]; =20 gpp->reg_num =3D group; --=20 2.43.0 From nobody Thu Nov 28 22:38:05 2024 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D92B13635B; Thu, 26 Sep 2024 14:11:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727359877; cv=none; b=D86ke4n31SrF6/cv1X7j9z2NEaQU8LibskprLts0kUt0IaNkK5m9eJSzOLhlGNfotTi+7rWH68GlNmtoyaD8tAaNgEvJiDH7IDqXULqR5/d0G6q6WY43lXr6jeaz4fIzQxKGgeKL2jZH5Rbr2dwcZbSqbikh/cwBN9RWHG4fDYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727359877; c=relaxed/simple; bh=hIgS0abct7k73cRUqrRv+pssPSaxyTvM8bbfQ9Nc/cU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IVXIfkSFW/R5PrkPzt9tK9Fp9gTcKknK6jPt9cHiGAsQbB33tIRWiufM7r+HRlGFPlWvmvg0W6fE+FCy9UxwmIVSYCb8dhO5FzxYGKZa/QzrdyvdMtuz0X7PHE5UP59Gsh49S6/yUJG5Y70LyZILAK45gdFfeBn6E6laJY56Vj0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QNFDVJvA; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QNFDVJvA" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5c718bb04a3so1238849a12.3; Thu, 26 Sep 2024 07:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727359875; x=1727964675; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=CDLW+ahil14VVbokXmkrACjSas1yGjqF032hu3qw1pw=; b=QNFDVJvAvAMsqg0lvpRE5FjATt+5PjniLqxFLELvHLlpSohlT1R4Fl26yoZZ8yUBUM 4j3eebDbZRXeguYOSTpq7FwoMhq2AdreNuwR3FIC19oonGHlMx+CV6RpZv4rzdM9o8BM OQYbrr9PFVJrdFB5W397zJjObJXMdQ/TxPBuZJBulRn3b9nfFKvG42WvJzmxIVb9q5AM OrgMF4ZjF6WQkxLcunV55MQoPyLwzMucK08Qv5glumybybgisaQijr8eiSGW/b8IiyLH yoPwMmtkt1z51vVparmt2H7cwToLnJmJKh0s+eexK+AaoWX8bjksU5pVpmbUZvvlFRKU ZOmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727359875; x=1727964675; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CDLW+ahil14VVbokXmkrACjSas1yGjqF032hu3qw1pw=; b=FL5BZ3YnETBLmipHvTwXXeNsQzKEEIik5cta3Oh3x/OFHOD/ew2cRF20FG4sdUr45x ARqJCaSbGGB6He1jo2XWTr631kJGKKPTnogRcnDHG5zZtumQ2ysoPbVRy7eDU6xd6L7w Opit5E/LEIs5qiWcF8i6gL3j4co1iHfLj+/iHViSmNZSUoJhupNE6D3tJv5fA+pBlmHS mZa0TXipHSfmBllGV+eckf2c4uujBywke2clrMihtnSd+7ePddrHO1sFDFwCdVQ06EcR Qh6pOsVCBx6jpJSMOWBAaPsqB6AXJbTMOcgLKyg3DDbTSOW0WzeIV7sGuRBJ8y90DfW0 yN4Q== X-Forwarded-Encrypted: i=1; AJvYcCWp7Qxk+WpC11Orc9NaUtaRh/pxW9x2LPv65RKmALJ6H1JH6Fj8U+XvkHBPzO0+YYRzYdPZeqHGeNiGG6Fv@vger.kernel.org, AJvYcCXs/i5c/5svMcKWlShFywPtZnX5Yqg5pPNws9WkGSlYFo7ZHrbzU5/wSBjT7SS8ae2MeOycw8wGpOf/@vger.kernel.org X-Gm-Message-State: AOJu0YwdUxDOpf7+aY8bs2ByQ5F6oX5zJg5a4RKSBJH4KqBSuEf267wc du/hnkiKTxn2XPA8bFjdSQiKS7iP41lqwr+6ho+8xY2U5wfQOP07 X-Google-Smtp-Source: AGHT+IHn0TuZveX/3tC1YU4PdfQVGg3OLRpmfNWqEyYD6hdxKsXTUJK2l6073A6+0miR78UiBA3arQ== X-Received: by 2002:a17:906:6a0c:b0:a86:9793:350d with SMTP id a640c23a62f3a-a93a06a46c1mr734433566b.62.1727359874448; Thu, 26 Sep 2024 07:11:14 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-4e5f-6907-08e4-04ed.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:4e5f:6907:8e4:4ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27776cesm2498866b.40.2024.09.26.07.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 07:11:13 -0700 (PDT) From: Javier Carrasco Date: Thu, 26 Sep 2024 16:11:03 +0200 Subject: [PATCH 2/2] pinctrl: intel: platform: use semicolon instead of comma in ncommunities assignment Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240926-intel-pinctrl-platform-scoped-v1-2-5ee4c936eea3@gmail.com> References: <20240926-intel-pinctrl-platform-scoped-v1-0-5ee4c936eea3@gmail.com> In-Reply-To: <20240926-intel-pinctrl-platform-scoped-v1-0-5ee4c936eea3@gmail.com> To: Mika Westerberg , Andy Shevchenko , Linus Walleij Cc: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727359869; l=956; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=hIgS0abct7k73cRUqrRv+pssPSaxyTvM8bbfQ9Nc/cU=; b=/OWhC2JDj29etn04UL/vKwP5FjUhZkfIodwxbe5jqYBgTruWh5Nw7z9zHG+SZU3mrlohuT1Wp StH5IB6iSPjAH+c2E6hDIcVQYY2ihMEREYH2y2kFIyVc+XUMmXpv0mR X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Substitute the comma with a semicolon in the `ncommunities` assignment for better readability and consistency with common C coding style. Signed-off-by: Javier Carrasco Acked-by: Mika Westerberg --- drivers/pinctrl/intel/pinctrl-intel-platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel-platform.c b/drivers/pinct= rl/intel/pinctrl-intel-platform.c index 2d5ba8278fb9..016a9f62eecc 100644 --- a/drivers/pinctrl/intel/pinctrl-intel-platform.c +++ b/drivers/pinctrl/intel/pinctrl-intel-platform.c @@ -158,7 +158,7 @@ static int intel_platform_pinctrl_prepare_soc_data(stru= ct device *dev, int ret; =20 /* Version 1.0 of the specification assumes only a single community per d= evice node */ - ncommunities =3D 1, + ncommunities =3D 1; communities =3D devm_kcalloc(dev, ncommunities, sizeof(*communities), GFP= _KERNEL); if (!communities) return -ENOMEM; --=20 2.43.0