summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-06-27 11:19:51 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-06-27 11:22:21 +0200
commit659512c07d87bbdcd2cfa2b6f2be58febcd67841 (patch)
treeba6df8f061106400f2825b0a1ae1671fb74e69b6
parent9c2b81e0e1fa930f41451f8b6ac35d82ed5ce922 (diff)
downloadbarebox-659512c07d87bbdcd2cfa2b6f2be58febcd67841.tar.gz
pinctrl: at91: Bail out if atmel,pins property does not exist
Do not blindly assume that a device node has a atmel,pins property. Instead, test it for being NULL before using it. This also silences a compiler warning when the driver is compiled without OF support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/pinctrl/pinctrl-at91.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 021c1e5..d52c184 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -449,6 +449,9 @@ static int at91_pinctrl_set_state(struct pinctrl_device *pdev, struct device_nod
info = to_at91_pinctrl(pdev);
list = of_get_property(np, "atmel,pins", &size);
+ if (!list)
+ return -EINVAL;
+
size /= sizeof(*list);
if (!size || size % 4) {