From: sashiko-bot@kernel.org
To: "Stefan Dösinger" <stefandoesinger@gmail.com>
Cc: linux-clk@vger.kernel.org, neil.armstrong@linaro.org,
olteanv@gmail.com, linux-phy@lists.infradead.org,
conor+dt@kernel.org, devicetree@vger.kernel.org,
vkoul@kernel.org, mfd@lists.linux.dev, robh@kernel.org,
lee@kernel.org
Subject: Re: [PATCH v13 10/13] clk: zte: Introduce a driver for zx297520v3 matrix clocks
Date: Sun, 27 Sep 2026 21:05:26 +0000 [thread overview]
Message-ID: <20260927210526.A632B1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927-zx29clk-v13-10-70d8f673386c@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] clk: zx297520v3: orphaned firmware clocks due to NULL dev->of_node
- [Low] clk: zx297520v3: compilation failure due to const initializers
--
commit 1f05d5e802fc7c2765df7aa9b0a1ac54ff100e45
Author: Stefan Dösinger <stefandoesinger@gmail.com>
clk: zte: Introduce a driver for zx297520v3 matrix clocks
This commit introduces a clock controller driver for the zx297520v3 matrix
clocks, covering high-speed devices like CPU, DMA, RAM, SDIO, and Ethernet.
It defines fixed dividers, muxes, and gates for the matrix clock tree.
> diff --git a/drivers/clk/zte/clk-zx297520v3.c b/drivers/clk/zte/clk-zx297520v3.c
> index 68bfeab84d745..d5f8bc4064bd4 100644
> --- a/drivers/clk/zte/clk-zx297520v3.c
> +++ b/drivers/clk/zte/clk-zx297520v3.c
[ ... ]
> @@ -812,6 +812,528 @@ static const struct zx_clk_data zx297520v3_topclk_data = {
[ ... ]
> +static const struct zx_parent_desc matrix_unk = PARENT_FW("wclk-osc26m");
[ ... ]
> +static const struct zx_clock zx297520v3_matrix_clocks[] = {
[ ... ]
> + [ZX_CLK_CPU_WCLK] = GATE("cpu-wclk", PARENT_ID(ZX_CLK_CPU_MUX), 0x24, 1,
> + CLK_IS_CRITICAL),
> + [ZX_CLK_CPU_PCLK] = GATE("cpu-pclk", clk_main[0], 0x24, 2, CLK_IS_CRITICAL),
[Severity: Low]
Is this code valid C?
The array element clk_main[0] is being used as a static struct initializer.
In C, unlike C++, array elements and const variables are not constant
expressions, which will produce a fatal "initializer element is not constant"
build error.
[ ... ]
> + [ZX_CLK_PDCFG_WCLK] = GATE("pdcfg-wclk", matrix_unk, 0x88, 0, CLK_IS_CRITICAL),
[Severity: Low]
Does this initializer also fail to build?
Similar to the above, matrix_unk is a const variable and cannot be used
as a static struct initializer in C.
[ ... ]
> +static const struct zx_clk_data zx297520v3_matrixclk_data = {
> + .init = zx297520v3_matrix_init,
> + .clocks = zx297520v3_matrix_clocks,
> + .num_clocks = ARRAY_SIZE(zx297520v3_matrix_clocks),
> + .exports = zx297520v3_matrix_exports,
> + .num_exports = ARRAY_SIZE(zx297520v3_matrix_exports),
> +};
> +
> static int clk_zx297520v3_probe(struct platform_device *pdev)
> {
> const struct platform_device_id *id = platform_get_device_id(pdev);
>
> if (!id)
> return -ENODEV;
>
> return zx_clk_common_probe(&pdev->dev, pdev->dev.parent->of_node,
> (const struct zx_clk_data *)id->driver_data);
> }
[Severity: High]
Does this code leave all firmware-based clocks orphaned?
The parent's of_node is passed explicitly to zx_clk_common_probe() for
validation and provider registration, but it is never assigned to
pdev->dev.of_node. Since the matrix clock controller is an MFD child device
without an of_compatible, its pdev->dev.of_node will be NULL.
When registering the clocks, the Common Clock Framework relies on dev->of_node
to resolve fw_name parents. For example, in zx_clk_register_fixed_div() in
drivers/clk/zte/clk-zx.c:
case ZX_PARENT_FW:
return devm_clk_hw_register_fixed_factor_fwname(dev, NULL,
desc->name, p->fw_name,
CLK_SET_RATE_PARENT, 1, desc->div);
Because dev->of_node is NULL, clk_core_fill_parent()'s of_clk_get_by_name()
will instantly return -ENOENT.
Should pdev->dev.of_node be assigned before probing so the CCF can resolve
the clock tree?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927-zx29clk-v13-0-70d8f673386c@gmail.com?part=10
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Stefan Dösinger" <stefandoesinger@gmail.com>
Cc: linux-clk@vger.kernel.org, neil.armstrong@linaro.org,
olteanv@gmail.com, linux-phy@lists.infradead.org,
conor+dt@kernel.org, devicetree@vger.kernel.org,
vkoul@kernel.org, mfd@lists.linux.dev, robh@kernel.org,
lee@kernel.org
Subject: Re: [PATCH v13 10/13] clk: zte: Introduce a driver for zx297520v3 matrix clocks
Date: Sun, 27 Sep 2026 21:05:26 +0000 [thread overview]
Message-ID: <20260927210526.A632B1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927-zx29clk-v13-10-70d8f673386c@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] clk: zx297520v3: orphaned firmware clocks due to NULL dev->of_node
- [Low] clk: zx297520v3: compilation failure due to const initializers
--
commit 1f05d5e802fc7c2765df7aa9b0a1ac54ff100e45
Author: Stefan Dösinger <stefandoesinger@gmail.com>
clk: zte: Introduce a driver for zx297520v3 matrix clocks
This commit introduces a clock controller driver for the zx297520v3 matrix
clocks, covering high-speed devices like CPU, DMA, RAM, SDIO, and Ethernet.
It defines fixed dividers, muxes, and gates for the matrix clock tree.
> diff --git a/drivers/clk/zte/clk-zx297520v3.c b/drivers/clk/zte/clk-zx297520v3.c
> index 68bfeab84d745..d5f8bc4064bd4 100644
> --- a/drivers/clk/zte/clk-zx297520v3.c
> +++ b/drivers/clk/zte/clk-zx297520v3.c
[ ... ]
> @@ -812,6 +812,528 @@ static const struct zx_clk_data zx297520v3_topclk_data = {
[ ... ]
> +static const struct zx_parent_desc matrix_unk = PARENT_FW("wclk-osc26m");
[ ... ]
> +static const struct zx_clock zx297520v3_matrix_clocks[] = {
[ ... ]
> + [ZX_CLK_CPU_WCLK] = GATE("cpu-wclk", PARENT_ID(ZX_CLK_CPU_MUX), 0x24, 1,
> + CLK_IS_CRITICAL),
> + [ZX_CLK_CPU_PCLK] = GATE("cpu-pclk", clk_main[0], 0x24, 2, CLK_IS_CRITICAL),
[Severity: Low]
Is this code valid C?
The array element clk_main[0] is being used as a static struct initializer.
In C, unlike C++, array elements and const variables are not constant
expressions, which will produce a fatal "initializer element is not constant"
build error.
[ ... ]
> + [ZX_CLK_PDCFG_WCLK] = GATE("pdcfg-wclk", matrix_unk, 0x88, 0, CLK_IS_CRITICAL),
[Severity: Low]
Does this initializer also fail to build?
Similar to the above, matrix_unk is a const variable and cannot be used
as a static struct initializer in C.
[ ... ]
> +static const struct zx_clk_data zx297520v3_matrixclk_data = {
> + .init = zx297520v3_matrix_init,
> + .clocks = zx297520v3_matrix_clocks,
> + .num_clocks = ARRAY_SIZE(zx297520v3_matrix_clocks),
> + .exports = zx297520v3_matrix_exports,
> + .num_exports = ARRAY_SIZE(zx297520v3_matrix_exports),
> +};
> +
> static int clk_zx297520v3_probe(struct platform_device *pdev)
> {
> const struct platform_device_id *id = platform_get_device_id(pdev);
>
> if (!id)
> return -ENODEV;
>
> return zx_clk_common_probe(&pdev->dev, pdev->dev.parent->of_node,
> (const struct zx_clk_data *)id->driver_data);
> }
[Severity: High]
Does this code leave all firmware-based clocks orphaned?
The parent's of_node is passed explicitly to zx_clk_common_probe() for
validation and provider registration, but it is never assigned to
pdev->dev.of_node. Since the matrix clock controller is an MFD child device
without an of_compatible, its pdev->dev.of_node will be NULL.
When registering the clocks, the Common Clock Framework relies on dev->of_node
to resolve fw_name parents. For example, in zx_clk_register_fixed_div() in
drivers/clk/zte/clk-zx.c:
case ZX_PARENT_FW:
return devm_clk_hw_register_fixed_factor_fwname(dev, NULL,
desc->name, p->fw_name,
CLK_SET_RATE_PARENT, 1, desc->div);
Because dev->of_node is NULL, clk_core_fill_parent()'s of_clk_get_by_name()
will instantly return -ENOENT.
Should pdev->dev.of_node be assigned before probing so the CCF can resolve
the clock tree?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927-zx29clk-v13-0-70d8f673386c@gmail.com?part=10
next prev parent reply other threads:[~2026-09-27 21:05 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 20:13 [PATCH v13 00/13] ZTE zx297520v3 clock bindings and driver Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:13 ` [PATCH v13 01/13] dt-bindings: clk: zte: Add zx297520v3 top clock and reset controller Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:54 ` sashiko-bot
2026-09-27 20:54 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 03/13] dt-bindings: clk: zte: Add zx297520v3 LSP " Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:54 ` sashiko-bot
2026-09-27 20:54 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 04/13] mfd: zx297520v3: Add a clock and reset MFD driver Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:57 ` sashiko-bot
2026-09-27 20:57 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 05/13] Maintainers: Add entry for drivers/mfd/zte-zx297520v3-crm.c Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:13 ` [PATCH v13 06/13] clk: zte: Add Clock registration infrastructure Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:59 ` sashiko-bot
2026-09-27 20:59 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 07/13] clk: zte: Add regmap-based clocks Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:59 ` sashiko-bot
2026-09-27 20:59 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 08/13] clk: zte: Add zx PLL support infrastructure Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 21:00 ` sashiko-bot
2026-09-27 21:00 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 09/13] clk: zte: Introduce a driver for zx297520v3 top clocks Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 21:00 ` sashiko-bot
2026-09-27 21:00 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 10/13] clk: zte: Introduce a driver for zx297520v3 matrix clocks Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 21:05 ` sashiko-bot [this message]
2026-09-27 21:05 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 11/13] clk: zte: Introduce a driver for zx297520v3 LSP clocks Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:58 ` sashiko-bot
2026-09-27 20:58 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 12/13] reset: zte: Add a zx297520v3 reset driver Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:59 ` sashiko-bot
2026-09-27 20:59 ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 13/13] ARM: dts: zte: Declare zx297520v3 CRM device nodes Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:57 ` sashiko-bot
2026-09-27 20:57 ` sashiko-bot
2026-09-27 20:50 ` [PATCH v13 02/13] dt-bindings: clk: zte: Add zx297520v3 matrix clock and reset controller Stefan Dösinger
2026-09-27 20:50 ` Stefan Dösinger
2026-09-27 20:54 ` sashiko-bot
2026-09-27 20:54 ` sashiko-bot
2026-10-02 15:08 ` (subset) [PATCH v13 00/13] ZTE zx297520v3 clock bindings and driver Brian Masney
2026-10-02 15:08 ` Brian Masney
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=20260927210526.A632B1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lee@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=mfd@lists.linux.dev \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=stefandoesinger@gmail.com \
--cc=vkoul@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.