mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: check ops->pin_config_set in pinconf_set_config()
@ 2017-08-04  2:59 Masahiro Yamada
  2017-08-04 10:12 ` Mika Westerberg
  2017-08-07 13:21 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2017-08-04  2:59 UTC (permalink / raw)
  To: linux-gpio
  Cc: Andy Shevchenko, Mika Westerberg, Masahiro Yamada, Linus Walleij,
	linux-kernel

pinconf_set_config() is called by pinctrl_gpio_set_config().
If a GPIO driver is backed by a pinctrl driver and it does not
support .pin_config_set() hook, it causes NULL pointer dereference.

Fixes: 15381bc7c7f5 ("pinctrl: Allow configuration of pins from gpiolib based drivers")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/pinctrl/pinconf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index 92f363793f35..d3fe14394b73 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -205,7 +205,7 @@ int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
 	const struct pinconf_ops *ops;
 
 	ops = pctldev->desc->confops;
-	if (!ops)
+	if (!ops || !ops->pin_config_set)
 		return -ENOTSUPP;
 
 	return ops->pin_config_set(pctldev, pin, configs, nconfigs);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-07 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04  2:59 [PATCH] pinctrl: check ops->pin_config_set in pinconf_set_config() Masahiro Yamada
2017-08-04 10:12 ` Mika Westerberg
2017-08-07 13:21 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome