gpio: mvebu: fail probe if gpiochip registration fails

mvebu_gpio_probe() registers the GPIO chip with
devm_gpiochip_add_data() but ignores the return value. If registration
fails, probe continues and leaves later code operating on a GPIO chip
that was never published to gpiolib.

Return the registration error so the device fails probe cleanly.

Fixes: fefe7b0923 ("gpio: introduce gpio-mvebu driver for Marvell SoCs")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260624131645.86884-1-pengpeng@iscas.ac.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
Pengpeng Hou
2026-06-24 21:16:45 +08:00
committed by Bartosz Golaszewski
parent 962528fef9
commit 479e91fc92

View File

@@ -1221,7 +1221,10 @@ 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 dev_err_probe(&pdev->dev, err,
"failed to register gpiochip\n");
/* Some MVEBU SoCs have simple PWM support for GPIO lines */
if (IS_REACHABLE(CONFIG_PWM)) {