summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-08-04 04:59:32 +0200
committerLinus Walleij <linus.walleij@linaro.org>2017-08-14 15:01:59 +0200
commit17a512486bab646109770f6577396810e83acfbb (patch)
treed7221d679df9c278338266c55a15408b25985860
parentpinctrl: intel: Add Intel Denverton pin controller support (diff)
downloadlinux-17a512486bab646109770f6577396810e83acfbb.tar.xz
linux-17a512486bab646109770f6577396810e83acfbb.zip
pinctrl: check ops->pin_config_set in pinconf_set_config()
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> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/pinconf.c2
1 files changed, 1 insertions, 1 deletions
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);