pinctrl: single: fix pinctrl_spec.args_count bounds check
authorDrew Fustini <drew@beagleboard.org>
Wed, 30 Sep 2020 17:48:40 +0000 (12:48 -0500)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 1 Oct 2020 08:02:45 +0000 (10:02 +0200)
commit9b9448f39e83d8e6fdfed006c5db8c304a98c2cd
treecde13856d308c97ad80d4b2f36ae6f9806df097e
parenta0cec28c965285c4debc00b035552f8096f2aee4
pinctrl: single: fix pinctrl_spec.args_count bounds check

The property #pinctrl-cells can either be 1 or 2:

- if #pinctrl-cells = <1>, then pinctrl_spec.args_count = 2
- if #pinctrl-cells = <2>, then pinctrl_spec.args_count = 3

All other values of pinctrl_spec.args_count are incorrect.  This fix
checks the upper bound instead of just the lower bound.

Fixes: a13395418888 ("pinctrl: single: parse #pinctrl-cells = 2")
Reported-by: Trent Piepho <tpiepho@gmail.com>
Signed-off-by: Drew Fustini <drew@beagleboard.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/linux-omap/3139716.CMS8C0sQ7x@zen.local/
Link: https://lore.kernel.org/r/20200930174839.1308344-1-drew@beagleboard.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-single.c