[PATCH 6/9] pinctrl: Rockchip: abort probe on lack of aliases

Ahmad Fatoum a.fatoum at pengutronix.de
Sun Nov 7 23:52:06 PST 2021


The driver depends on the existence of aliases and will read
out-of-bounds if they are missing for a node. Make failure
graceful by aborting before that happens.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/pinctrl/pinctrl-rockchip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 4f0951bb289a..1fdb9a913ad3 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -334,6 +334,9 @@ static int rockchip_gpio_probe(struct device_d *dev)
 	int ret, bankno;
 
 	bankno = of_alias_get_id(dev->device_node, "gpio");
+	if (bankno < 0)
+		return bankno;
+
 	bank = &ctrl->pin_banks[bankno];
 	gpio = &bank->bgpio_chip.gc;
 
-- 
2.30.2




More information about the barebox mailing list