Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Xiaolei Wang <xiaoleiwangxiaolei@gmail.com>
Cc: aisheng.dong@nxp.com, festevam@gmail.com, Frank.Li@nxp.com,
	ping.bai@nxp.com, kernel@pengutronix.de, s32@nxp.com,
	linusw@kernel.org, s.hauer@pengutronix.de,
	sudeep.holla@kernel.org, cristian.marussi@arm.com,
	peng.fan@nxp.com, linux-gpio@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] pinctrl: imx: scmi: replace custom dt_free_map with pinctrl_utils_free_map
Date: Mon, 26 Oct 2026 11:47:25 -0500	[thread overview]
Message-ID: <at-EHbO9KntKl7jY@SMW015318> (raw)
In-Reply-To: <20261026040230.22338-1-xiaoleiwangxiaolei@gmail.com>

On Mon, Oct 26, 2026 at 12:02:30PM +0800, Xiaolei Wang wrote:
> [You don't often get email from xiaoleiwangxiaolei@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Wang Xiaolei <xiaoleiwangxiaolei@gmail.com>
>
> 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@vger.kernel.org
> Signed-off-by: Wang Xiaolei <xiaoleiwangxiaolei@gmail.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
> index 613552e35070..8cbd66950848 100644
> --- a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
> +++ b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
> @@ -153,18 +153,12 @@ static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev,
>         return 0;
>  }
>
> -static void pinctrl_scmi_imx_dt_free_map(struct pinctrl_dev *pctldev,
> -                                        struct pinctrl_map *map, unsigned int num_maps)
> -{
> -       kfree(map);
> -}
> -
>  static const struct pinctrl_ops pinctrl_scmi_imx_pinctrl_ops = {
>         .get_groups_count = pinctrl_generic_get_group_count,
>         .get_group_name = pinctrl_generic_get_group_name,
>         .get_group_pins = pinctrl_generic_get_group_pins,
>         .dt_node_to_map = pinctrl_scmi_imx_dt_node_to_map,
> -       .dt_free_map = pinctrl_scmi_imx_dt_free_map,
> +       .dt_free_map = pinctrl_utils_free_map,
>  };
>
>  static int pinctrl_scmi_imx_func_set_mux(struct pinctrl_dev *pctldev,
> --
> 2.34.1
>
>


      reply	other threads:[~2026-10-26 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26  4:02 [PATCH] pinctrl: imx: scmi: replace custom dt_free_map with pinctrl_utils_free_map Xiaolei Wang
2026-10-26 16:47 ` Frank Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=at-EHbO9KntKl7jY@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=cristian.marussi@arm.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=s32@nxp.com \
    --cc=stable@vger.kernel.org \
    --cc=sudeep.holla@kernel.org \
    --cc=xiaoleiwangxiaolei@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox