[PATCH 1/3] pinctrl: single: Also free the pinconf table of a duplicate function

From: A. Sverdlin

Date: Thu Nov 19 2026 - 18:29:11 EST


From: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxxxx>

pcs_parse_pinconf() attaches a devm-allocated pcs_conf_vals array to the
function pcs_add_function() has just allocated. When a node is mapped
again, e.g. on consumer re-probe, that function is a duplicate of the one
the core keeps and is freed since commit ad2093840ca3 ("pinctrl: single:
don't leak group/function tables on consumer re-probe"), but its conf
array stays on the controller's devres list. It accumulates with every
re-probe of a consumer whose pin group has pinconf properties, until the
controller is unbound.

Free it together with the function.

Fixes: 9dddb4df90d1 ("pinctrl: single: support generic pinconf")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxxxx>
---
drivers/pinctrl/pinctrl-single.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index d72ebb186b894..64472465800c4 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1107,6 +1107,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
if (pinmux_generic_get_function(pcs->pctl, fsel)->data != function) {
devm_kfree(pcs->dev, pins);
devm_kfree(pcs->dev, vals);
+ devm_kfree(pcs->dev, function->conf);
devm_kfree(pcs->dev, function);
devm_kfree(pcs->dev, pgnames);
}
--
2.56.1