Skip to contentSkip to conversation

pinctrl: intel: Simplify offset validation in intel_get_padcfg()

PATCH In review Andy Shevchenko 2 participants 2 messages Jul 23, 2019 – Aug 6, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: intel: Simplify offset validation in intel_get_padcfg()

There is more generic and simpler validation just against the nregs. Using it allows to drop customization from the intel_get_padcfg().

---
 drivers/pinctrl/intel/pinctrl-intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/intel/pinctrl-intel.c +1 -1
index 99c5bca789eb..1e8018edde4d 100644
@@ -166,7 +166,7 @@ static void __iomem *intel_get_padcfg(struct intel_pinctrl *pctrl,
 	padno = pin_to_padno(community, pin);
 	nregs = (community->features & PINCTRL_FEATURE_DEBOUNCE) ? 4 : 2;
 
-	if (reg == PADCFG2 && !(community->features & PINCTRL_FEATURE_DEBOUNCE))
+	if (reg >= nregs * 4)
 		return NULL;
 
 	return community->pad_regs + reg + padno * nregs * 4;
Signature · 1 line
2.20.1