[PATCH] pinctrl: at91: Bail out if atmel, pins property does not exist

Sascha Hauer s.hauer at pengutronix.de
Tue Jun 27 02:23:57 PDT 2017


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 at pengutronix.de>
---
 drivers/pinctrl/pinctrl-at91.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 021c1e5a2e..d52c184e44 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) {
-- 
2.11.0




More information about the barebox mailing list