gpio: mvebu: fail probe if gpiochip registration fails

[ Upstream commit 479e91fc92 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Pengpeng Hou
2026-07-24 16:03:24 +02:00
committed by Greg Kroah-Hartman
parent 0567b5bcbd
commit f0320c623f
+4 -1
View File
@@ -1232,7 +1232,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)) {