Re: [PATCH] pinctrl: imx: scmi: replace custom dt_free_map with pinctrl_utils_free_map

From: Linus Walleij

Date: Wed Nov 04 2026 - 08:47:51 EST


On Mon, Oct 26, 2026 at 5:02 AM Xiaolei Wang
<xiaoleiwangxiaolei@xxxxxxxxx> wrote:

> From: Wang Xiaolei <xiaoleiwangxiaolei@xxxxxxxxx>
>
> pinctrl_scmi_imx_dt_node_to_map() kmemdup_array()s the pinctrl configs
> of every pin into map[i].data.configs.configs, but the driver's own
> pinctrl_scmi_imx_dt_free_map() only frees the map array itself. The
> pinctrl core releases maps through pinctrl_dt_free_maps(), which calls
> dt_free_map(); the duplicated configs are therefore never freed and leak
> every time the DT node is parsed, e.g. on each (deferred) probe attempt.
>
> Replace the custom dt_free_map with the core helper
> pinctrl_utils_free_map(), which frees the configs of each
> PIN_MAP_TYPE_CONFIGS_* map before freeing the map itself. Its
> signature matches pinctrl_ops.dt_free_map(), so the driver-specific
> implementation can be dropped entirely.
>
> Detected with kmemleak on an i.MX95 board (FRDM-IMX95).
>
> Fixes: b755521fd6eb ("pinctrl: imx: support SCMI pinctrl protocol for i.MX95")
> Cc: stable@xxxxxxxxxxxxxxx

No way I'm sending that to stable, it's no regression.

> Signed-off-by: Wang Xiaolei <xiaoleiwangxiaolei@xxxxxxxxx>

Patch applied as a nonurgent fix.

Yours,
Linus Walleij