[PATCH] pinctrl: bcm: release the NS2 pinmux controller on detach

From: Wentao Liang

Date: Tue Nov 03 2026 - 06:47:29 EST


ns2_pinmux_probe() registers the pin controller with pinctrl_register()
and stores the returned pinctrl_dev in the driver data, but the driver
has no remove callback and never calls pinctrl_unregister(). The
controller is therefore never unregistered and its memory is leaked
when the platform device is unbound.

Use devm_pinctrl_register() instead so that the controller is released
automatically when the device is detached.

Fixes: b5aa1006e4a9 ("pinctrl: ns2: add pinmux driver support for Broadcom NS2 SoC")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
index 23ab3ab064b6..a1480641ee0b 100644
--- a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
+++ b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
@@ -1077,8 +1077,8 @@ static int ns2_pinmux_probe(struct platform_device *pdev)
pinctrl->num_functions = ARRAY_SIZE(ns2_pin_functions);
ns2_pinctrl_desc.pins = pins;

- pinctrl->pctl = pinctrl_register(&ns2_pinctrl_desc, &pdev->dev,
- pinctrl);
+ pinctrl->pctl = devm_pinctrl_register(&pdev->dev, &ns2_pinctrl_desc,
+ pinctrl);
if (IS_ERR(pinctrl->pctl)) {
dev_err(&pdev->dev, "unable to register IOMUX pinctrl\n");
return PTR_ERR(pinctrl->pctl);
--
2.34.1