[PATCH v2 4/4] pinctrl: single: Drop unused fshift and fmax

A. Sverdlin alexander.sverdlin at siemens.com
Thu Nov 26 07:45:25 PST 2026


From: Alexander Sverdlin <alexander.sverdlin at siemens.com>

pcs_probe() derives fshift and fmax from "pinctrl-single,function-mask",
but nothing reads them: fmax was never used and the last user of fshift
went away with commit 2243a87d90b4 ("pinctrl: avoid duplicated calling
enable_pinmux_setting for a pin").

The computation isn't harmless either: a function-mask of 0 passes
__ffs(0) and then shifts the mask by the undefined result.

Remove both fields.

Reported-by: Sashiko <sashiko-bot at kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-224208@kernel.org/
Signed-off-by: Alexander Sverdlin <alexander.sverdlin at siemens.com>
---
Changelog:
v2:
- patch introduced

 drivers/pinctrl/pinctrl-single.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index ba5782b6b63d0..9fbc132517c79 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -154,9 +154,7 @@ struct pcs_soc_data {
  * @mutex:	mutex protecting the lists
  * @width:	bits per mux register
  * @fmask:	function register mask
- * @fshift:	function register shift
  * @foff:	value to turn mux off
- * @fmax:	max number of functions in fmask
  * @bits_per_mux: number of bits per mux
  * @bits_per_pin: number of bits per pin
  * @pins:	physical pins on the SoC
@@ -187,9 +185,7 @@ struct pcs_device {
 	struct mutex mutex;
 	unsigned width;
 	unsigned fmask;
-	unsigned fshift;
 	unsigned foff;
-	unsigned fmax;
 	bool bits_per_mux;
 	unsigned bits_per_pin;
 	struct pcs_data pins;
@@ -1843,15 +1839,9 @@ static int pcs_probe(struct platform_device *pdev)
 
 	ret = of_property_read_u32(np, "pinctrl-single,function-mask",
 				   &pcs->fmask);
-	if (!ret) {
-		pcs->fshift = __ffs(pcs->fmask);
-		pcs->fmax = pcs->fmask >> pcs->fshift;
-	} else {
-		/* If mask property doesn't exist, function mux is invalid. */
+	/* If mask property doesn't exist, function mux is invalid. */
+	if (ret)
 		pcs->fmask = 0;
-		pcs->fshift = 0;
-		pcs->fmax = 0;
-	}
 
 	ret = of_property_read_u32(np, "pinctrl-single,function-off",
 					&pcs->foff);
-- 
2.56.1




More information about the linux-arm-kernel mailing list