From: sashiko-bot@kernel.org
To: "Chancel Liu" <chancel.liu@oss.nxp.com>
Cc: conor+dt@kernel.org, imx@lists.linux.dev, robh@kernel.org,
devicetree@vger.kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v3 09/17] arm64: dts: imx943-evk: Add board muxes to select between CAN1/PDM and MQS1/MIC
Date: Mon, 24 Aug 2026 02:34:51 +0000 [thread overview]
Message-ID: <20260824023451.BB4F91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824022020.2812810-10-chancel.liu@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Repeated deferred probing of the `micfil` consumer causes severe devres memory and reference leaks in the `pinctrl-generic-mux` provider.
--
--- Patch [9]: [PATCH v3 09/17] arm64: dts: imx943-evk: Add board muxes to select between CAN1/PDM and MQS1/MIC ---
commit 77c9c6202b63305da0b9143118c00d14c3943f7f
Author: Chancel Liu <chancel.liu@nxp.com>
arm64: dts: imx943-evk: Add board muxes to select between CAN1/PDM and MQS1/MIC
This commit replaces static gpio-hogs with GPIO-controlled board muxes
using the pinctrl-multiplexer framework. It allows runtime selection between
conflicting functions (CAN1/PDM and MQS1/MICFIL) and updates the MICFIL node
to use this new pinctrl selection.
> diff --git a/arch/arm64/boot/dts/freescale/imx943-evk.dts b/arch/arm64/boot/dts/freescale/imx943-evk.dts
> index 64660f94f4e9c..07b782ef698ad 100644
> --- a/arch/arm64/boot/dts/freescale/imx943-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx943-evk.dts
[ ... ]
> @@ -710,7 +731,7 @@ &micfil {
> assigned-clock-rates = <3932160000>,
> <3612672000>, <393216000>,
> <361267200>, <49152000>;
> - pinctrl-0 = <&pinctrl_pdm>;
> + pinctrl-0 = <&pinctrl_pdm>, <&mic_fun>, <&pdm_fun>;
[Severity: High]
This is a pre-existing issue in the pinctrl-multiplexer driver, but routing
the micfil node to use this provider actively triggers it. Can this lead to
severe devres memory and reference leaks if the micfil consumer defers probe?
Looking at mux_pinmux_dt_node_to_map() in
drivers/pinctrl/pinctrl-generic-mux.c, resources are allocated against the
provider's device (pctldev->dev):
function = devm_kzalloc(pctldev->dev, sizeof(*function), GFP_KERNEL);
if (!function)
return -ENOMEM;
group_names = devm_kcalloc(pctldev->dev, 1, sizeof(*group_names), GFP_KERNEL);
if (!group_names)
return -ENOMEM;
function->mux_state = devm_mux_state_get_from_np(pctldev->dev, NULL, np_config);
When the micfil device defers probe after obtaining pinctrl handles (or is
unbound and rebound), the pinctrl core frees the consumer's maps. However,
these allocations remain on the provider device's devres list.
On the next probe attempt, mux_pinmux_dt_node_to_map() allocates new
structures and calls pinmux_generic_add_function(). Since the function name
already exists in the radix tree from the previous attempt, the pinctrl
core returns the old selector.
The newly allocated objects and the mux_chip reference acquired by
devm_mux_state_get_from_np() are abandoned on the provider's list. This
compounds the leak on every deferral and prevents the mux_chip from ever
being freed.
Should the pinctrl-generic-mux driver be fixed to tie these allocations to
the map lifecycle before we expose this path via the DTS change?
> pinctrl-names = "default";
> status = "okay";
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260824022020.2812810-1-chancel.liu@oss.nxp.com?part=9
next prev parent reply other threads:[~2026-08-24 2:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 2:20 [PATCH v3 00/17] arm64: dts: Add MQS1 sound card support for i.MX9 EVK platforms Chancel Liu
2026-08-24 2:20 ` [PATCH v3 01/17] arm64: dts: imx91_93_common: Add clock and sound-dai-cells properties for MQS Chancel Liu
2026-08-24 2:20 ` [PATCH v3 02/17] arm64: dts: imx91-11x11-evk: Add board muxes to select between PDM and MQS1 Chancel Liu
2026-08-24 2:35 ` sashiko-bot
2026-08-24 2:20 ` [PATCH v3 03/17] arm64: dts: imx91-11x11-evk: Add MQS1 pinmux, clocks and mark conflicting devices Chancel Liu
2026-08-24 2:20 ` [PATCH v3 04/17] arm64: dts: imx93-11x11-evk: Add board muxes to select between PDM and MQS1 Chancel Liu
2026-08-24 2:20 ` [PATCH v3 05/17] arm64: dts: imx93-11x11-evk: Add MQS1 pinmux, clocks and mark conflicting devices Chancel Liu
2026-08-24 2:20 ` [PATCH v3 06/17] arm64: dts: imx93-14x14-evk: Add board muxes to select between FlexCAN1 and MQS1 Chancel Liu
2026-08-24 2:20 ` [PATCH v3 07/17] arm64: dts: imx93-14x14-evk: Add MQS1 pinmux, clocks and mark conflicting devices Chancel Liu
2026-08-24 2:20 ` [PATCH v3 08/17] arm64: dts: imx94: Add clock and sound-dai-cells properties for MQS1 Chancel Liu
2026-08-24 2:20 ` [PATCH v3 09/17] arm64: dts: imx943-evk: Add board muxes to select between CAN1/PDM and MQS1/MIC Chancel Liu
2026-08-24 2:34 ` sashiko-bot [this message]
2026-08-24 2:20 ` [PATCH v3 10/17] arm64: dts: imx943-evk: Add MQS1 pinmux, clocks and mark conflicting devices Chancel Liu
2026-08-24 2:20 ` [PATCH v3 11/17] arm64: dts: imx95: Add clock and sound-dai-cells properties for MQS1 Chancel Liu
2026-08-24 2:20 ` [PATCH v3 12/17] arm64: dts: imx95-15x15-evk: Add board muxes to select between PDM and MQS1 Chancel Liu
2026-08-24 2:20 ` [PATCH v3 13/17] arm64: dts: imx95-15x15-evk: Add MQS1 pinmux, clocks and mark conflicting devices Chancel Liu
2026-08-24 2:20 ` [PATCH v3 14/17] arm64: dts: imx952: Add AONMIX MQS device node Chancel Liu
2026-08-24 2:20 ` [PATCH v3 15/17] arm64: dts: imx952-evk: Add board muxes to select between CAN1/PDM Chancel Liu
2026-08-24 2:40 ` sashiko-bot
2026-08-24 2:20 ` [PATCH v3 16/17] arm64: dts: imx952-evk: Add MQS1 pinmux, clocks and mark conflicting devices Chancel Liu
2026-08-24 2:20 ` [PATCH v3 17/17] arm64: dts: fsl: Add DT overlay to build MQS1 sound cards on i.MX9 platforms Chancel Liu
2026-08-24 2:42 ` sashiko-bot
2026-08-25 2:58 ` Chancel Liu
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=20260824023451.BB4F91F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=chancel.liu@oss.nxp.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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