1
0
Fork 0

pinctrl: pinmux: fix a possible null pointer in pinmux_can_be_used_for_gpio

[ Upstream commit 6ba2fd391a ]

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: 472a61e777 ("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>
5.4-rM2-2.2.x-imx-squashed
Alexandre Torgue 2019-12-04 15:41:06 +01:00 committed by Greg Kroah-Hartman
parent 2d68f35b7b
commit 0ef6ac6c12
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ bool pinmux_can_be_used_for_gpio(struct pinctrl_dev *pctldev, unsigned pin)
const struct pinmux_ops *ops = pctldev->desc->pmxops;
/* Can't inspect pin, assume it can be used */
if (!desc)
if (!desc || !ops)
return true;
if (ops->strict && desc->mux_usecount)