[PATCH] gpio: mvebu: fail probe if gpiochip registration fails

From: Pengpeng Hou

Date: Mon Jun 15 2026 - 05:23:13 EST


The MVEBU GPIO probe path ignores the return value from
devm_gpiochip_add_data(). If gpiochip registration fails, probe still
continues into optional PWM and IRQ-domain setup as if the GPIO provider
had been registered successfully.

Propagate the gpiochip registration error and stop probing in that case.

Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
drivers/gpio/gpio-mvebu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index c030d1f00abc..50dc8179cf73 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -1221,7 +1221,9 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
BUG();
}

- devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip);
+ err = devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip);
+ if (err)
+ return err;

/* Some MVEBU SoCs have simple PWM support for GPIO lines */
if (IS_REACHABLE(CONFIG_PWM)) {
--
2.50.1 (Apple Git-155)