From: sashiko-bot@kernel.org
To: "Louis-Alexis Eyraud" <louisalexis.eyraud@collabora.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 06/15] clk: mediatek: Add MT8189 apmixedsys clock support
Date: Thu, 02 Jul 2026 18:06:08 +0000 [thread overview]
Message-ID: <20260702180609.22CEF1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260701-mt8189-clocks-system-base-v1-6-2b048feea50a@collabora.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] I/O memory mapped for the `fhctl` node via `fhctl_parse_dt()` is permanently leaked if `mtk_clk_register_pllfhs()` fails during probe.
--
commit ee982ca814ef475721774644512ff52f2ca1b21d
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
clk: mediatek: Add MT8189 apmixedsys clock support
Add support for the MT8189 apmixedsys clock controller, which provides
PLLs generated from SoC 26m.
> diff --git a/drivers/clk/mediatek/clk-mt8189-apmixedsys.c b/drivers/clk/mediatek/clk-mt8189-apmixedsys.c
> new file mode 100644
> index 0000000000000..0657a50c30d9f
> --- /dev/null
> +++ b/drivers/clk/mediatek/clk-mt8189-apmixedsys.c
[ ... ]
> @@ -140,25 +140,25 @@ static int clk_mt8189_apmixed_probe(struct platform_device *pdev)
> + int r;
> + struct clk_hw_onecell_data *clk_data;
> + struct device_node *node = pdev->dev.of_node;
> + const u8 *fhctl_node = "mediatek,mt8189-fhctl";
> +
> + clk_data = mtk_alloc_clk_data(ARRAY_SIZE(apmixed_plls));
> + if (!clk_data)
> + return -ENOMEM;
> +
> + fhctl_parse_dt(fhctl_node, pllfhs, ARRAY_SIZE(pllfhs));
> +
> + r = mtk_clk_register_pllfhs(&pdev->dev, apmixed_plls, ARRAY_SIZE(apmixed_plls),
> + pllfhs, ARRAY_SIZE(pllfhs), clk_data);
> + if (r)
> + goto free_apmixed_data;
[Severity: Medium]
Does this code leak the I/O memory mapped for the fhctl node?
Looking at fhctl_parse_dt(), it calls of_iomap() and stores the mapped memory
base in the pllfhs structs.
If mtk_clk_register_pllfhs() fails, it returns an error and cleans up after
itself, but its internal error path does not unmap the fhctl base mapped by
fhctl_parse_dt().
Here, jumping to the free_apmixed_data label bypasses the call to
mtk_clk_unregister_pllfhs() (which would normally unmap the fhctl base).
Should the fhctl base be unmapped on this error path to prevent a memory
leak if the probe defers or fails?
> +
> + r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
> + if (r)
> + goto unregister_plls;
> +
> + platform_set_drvdata(pdev, clk_data);
> +
> + return 0;
> +
> +unregister_plls:
> + mtk_clk_unregister_pllfhs(apmixed_plls, ARRAY_SIZE(apmixed_plls), pllfhs,
> + ARRAY_SIZE(pllfhs), clk_data);
> +free_apmixed_data:
> + mtk_free_clk_data(clk_data);
> + return r;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701-mt8189-clocks-system-base-v1-0-2b048feea50a@collabora.com?part=6
next prev parent reply other threads:[~2026-07-02 18:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 13:11 [PATCH 00/15] MT8189: Add support for system and base clock controllers Louis-Alexis Eyraud
2026-07-01 13:11 ` [PATCH 01/15] dt-bindings: clock: mediatek: reorder MT8186 compatibles Louis-Alexis Eyraud
2026-07-01 13:11 ` [PATCH 02/15] dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186 Louis-Alexis Eyraud
2026-07-01 16:24 ` Rob Herring (Arm)
2026-07-01 19:33 ` Rob Herring
2026-07-02 18:06 ` sashiko-bot
2026-07-01 13:11 ` [PATCH 03/15] dt-bindings: clock: mediatek: regroup MT8192 " Louis-Alexis Eyraud
2026-07-02 18:06 ` sashiko-bot
2026-07-01 13:11 ` [PATCH 04/15] dt-bindings: clock: mediatek: regroup MT8195 " Louis-Alexis Eyraud
2026-07-02 18:06 ` sashiko-bot
2026-07-01 13:11 ` [PATCH 05/15] dt-bindings: clock: mediatek: Add MT8189 clocks Louis-Alexis Eyraud
2026-07-02 18:06 ` sashiko-bot
2026-07-01 13:11 ` [PATCH 06/15] clk: mediatek: Add MT8189 apmixedsys clock support Louis-Alexis Eyraud
2026-07-02 18:06 ` sashiko-bot [this message]
2026-07-01 13:11 ` [PATCH 07/15] clk: mediatek: Add MT8189 topckgen " Louis-Alexis Eyraud
2026-07-02 18:06 ` sashiko-bot
2026-07-01 13:11 ` [PATCH 08/15] clk: mediatek: Add MT8189 vlpckgen " Louis-Alexis Eyraud
2026-07-02 18:06 ` sashiko-bot
2026-07-01 13:11 ` [PATCH 09/15] clk: mediatek: Add MT8189 vlpcfg " Louis-Alexis Eyraud
2026-07-02 18:06 ` sashiko-bot
2026-07-01 13:11 ` [PATCH 10/15] clk: mediatek: Add MT8189 bus " Louis-Alexis Eyraud
2026-07-01 13:11 ` [PATCH 11/15] clk: mediatek: Add MT8189 dbgao " Louis-Alexis Eyraud
2026-07-01 13:11 ` [PATCH 12/15] clk: mediatek: Add MT8189 dvfsrc " Louis-Alexis Eyraud
2026-07-01 13:11 ` [PATCH 13/15] clk: mediatek: Add MT8189 i2c " Louis-Alexis Eyraud
2026-07-01 13:11 ` [PATCH 14/15] clk: mediatek: Add MT8189 scp " Louis-Alexis Eyraud
2026-07-02 18:06 ` sashiko-bot
2026-07-01 13:11 ` [PATCH 15/15] clk: mediatek: Add MT8189 ufs " Louis-Alexis Eyraud
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=20260702180609.22CEF1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=louisalexis.eyraud@collabora.com \
--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