From: Andy Shevchenko Date: Tue, 23 Jul 2019 15:55:14 +0000 (+0300) Subject: pinctrl: intel: Simplify offset validation in intel_get_padcfg() X-Git-Tag: v5.15~5482^2~2^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7eb7ecddd3bdb9fd616bc62348ed3aaccaa9ef83;p=platform%2Fkernel%2Flinux-starfive.git 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(). Signed-off-by: Andy Shevchenko Acked-by: Mika Westerberg --- diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 335b08d..913c5da 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -165,7 +165,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;