[PATCH 2/2] gpio: xlp: Unregister the GPIO chip on unbind

Tian Xuechen 202300460064 at mail.sdu.edu.cn
Sat Nov 28 03:02:29 PST 2026


From: Tian Xuechen <202300460064 at mail.sdu.edu.cn>

The XLP driver registers its GPIO chip without removing it on unbind.
The GPIO chip and its IRQ parent array are both managed allocations.

Use managed GPIO registration so the chip is removed before its
backing storage is freed.

This issue was found by our static analysis tool under development.

Fixes: ff7188000679 ("gpio: xlp: GPIO controller for Netlogic XLP SoCs")
Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
---
 drivers/gpio/gpio-xlp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-xlp.c b/drivers/gpio/gpio-xlp.c
index e9618608f2a0..89aab2663d62 100644
--- a/drivers/gpio/gpio-xlp.c
+++ b/drivers/gpio/gpio-xlp.c
@@ -291,7 +291,7 @@ static int xlp_gpio_probe(struct platform_device *pdev)
 	girq->default_type = IRQ_TYPE_NONE;
 	girq->handler = handle_level_irq;
 
-	err = gpiochip_add_data(gc, priv);
+	err = devm_gpiochip_add_data(&pdev->dev, gc, priv);
 	if (err < 0)
 		return err;
 
-- 
2.43.0




More information about the linux-riscv mailing list