pinctrl: pinmux: fix a possible null pointer in pinmux_can_be_used_for_gpio
authorAlexandre Torgue <alexandre.torgue@st.com>
Wed, 4 Dec 2019 14:41:06 +0000 (15:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Jan 2020 11:21:28 +0000 (12:21 +0100)
commit0ef6ac6c122c9adcd0f8f1740824e8e5eeeaec04
tree9a06bc00be2289556a30fb5d06acb8fab172e03f
parent2d68f35b7bcf77a4fbb34b683e291d0d01cba50c
pinctrl: pinmux: fix a possible null pointer in pinmux_can_be_used_for_gpio

[ Upstream commit 6ba2fd391ac58c1a26874f10c3054a1ea4aca2d0 ]

This commit adds a check on ops pointer to avoid a kernel panic when
ops->strict is used. Indeed, on some pinctrl driver (at least for
pinctrl-stmfx) the pinmux ops is not implemented. Let's assume than gpio
can be used in this case.

Fixes: 472a61e777fe ("pinctrl/gpio: Take MUX usage into account")
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
Link: https://lore.kernel.org/r/20191204144106.10876-1-alexandre.torgue@st.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/pinmux.c