]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
pinctrl: intel: Simplify offset validation in intel_get_padcfg()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 23 Jul 2019 15:55:14 +0000 (18:55 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 7 Aug 2019 13:44:55 +0000 (16:44 +0300)
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 <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/pinctrl/intel/pinctrl-intel.c

index 335b08d7d60973e8b5fc99467257b36d35b6c248..913c5dae773c986fbe2851a6b0ca551b3d1b2afd 100644 (file)
@@ -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;