Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Miquel Raynal (Schneider Electric)" <miquel.raynal@bootlin.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/7] clk: tests: Add clk_parse_clkspec() Kunit testing
Date: Fri, 10 Jul 2026 18:31:26 +0000	[thread overview]
Message-ID: <20260710183127.126261F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-2-b4680787377e@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Ignored return value of `of_clk_add_hw_provider_kunit()`.
--

--- Patch [2]: [PATCH v2 2/7] clk: tests: Add clk_parse_clkspec() Kunit testing ---
commit 4b569be51db687b32469c5799d300307be42e0b7
Author: Miquel Raynal (Schneider Electric) <miquel.raynal@bootlin.com>

clk: tests: Add clk_parse_clkspec() Kunit testing

This commit introduces a new set of KUnit tests to verify that
clk_parse_clkspec() functions properly. It validates whether valid lookups
by index and name return the correct devices, and checks that out-of-bounds
requests properly result in an error.

> diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c
> index b1961daac5e22..fddb2bb9618fd 100644
> --- a/drivers/clk/clk_test.c
> +++ b/drivers/clk/clk_test.c
[ ... ]
> @@ -3541,10 +3541,126 @@ static struct kunit_suite clk_hw_get_dev_of_node_test_suite = {
[ ... ]
> +static int clk_parse_clkspec_init(struct kunit *test)
> +{
> +	struct device_node *prov1_np, *prov2_np;
> +	struct clk_parse_clkspec_ctx *ctx;
> +	struct clk_hw *hw1, *hw2;
> +
> +	ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
> +	test->priv = ctx;
> +
> +	KUNIT_ASSERT_EQ(test, 0, of_overlay_apply_kunit(test, kunit_clk_parse_clkspec));
> +
> +	/* Register provider 1 */
> +	hw1 = kunit_kzalloc(test, sizeof(*hw1), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw1);
> +	hw1->init = &clk_parse_clkspec_1_init_data;
> +
> +	prov1_np = of_find_compatible_node(NULL, NULL, "test,clock-provider1");
> +	KUNIT_ASSERT_NOT_NULL(test, prov1_np);
> +
> +	KUNIT_ASSERT_EQ(test, 0, of_clk_hw_register_kunit(test, prov1_np, hw1));
> +	of_clk_add_hw_provider_kunit(test, prov1_np, of_clk_hw_simple_get, hw1);

[Severity: Medium]
Should the return value of of_clk_add_hw_provider_kunit() be verified here?

If the provider fails to register during setup, test initialization will 
continue as if it succeeded. This could mask the actual setup failure and
cause downstream tests to fail unpredictably. Adding a KUNIT_ASSERT_EQ check
similar to the of_clk_hw_register_kunit() call right above it might prevent 
this.

> +	of_node_put(prov1_np);
> +
> +	/* Register provider 2 */
> +	hw2 = kunit_kzalloc(test, sizeof(*hw2), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw2);
> +	hw2->init = &clk_parse_clkspec_2_init_data;
> +
> +	prov2_np = of_find_compatible_node(NULL, NULL, "test,clock-provider2");
> +	KUNIT_ASSERT_NOT_NULL(test, prov2_np);
> +
> +	KUNIT_ASSERT_EQ(test, 0, of_clk_hw_register_kunit(test, prov2_np, hw2));
> +	of_clk_add_hw_provider_kunit(test, prov2_np, of_clk_hw_simple_get, hw2);

[Severity: Medium]
Is it also necessary to check the return value of this second call to
of_clk_add_hw_provider_kunit() for the same reason?

> +	of_node_put(prov2_np);
> +
> +	ctx->cons_np = of_find_compatible_node(NULL, NULL, "test,clock-consumer");
> +	KUNIT_ASSERT_NOT_NULL(test, ctx->cons_np);
> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com?part=2

  reply	other threads:[~2026-07-10 18:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 18:21 [PATCH v2 0/7] clk: Add support for clock nexus Miquel Raynal (Schneider Electric)
2026-07-10 18:21 ` [PATCH v2 1/7] dt-bindings: clock: Introduce nexus nodes Miquel Raynal (Schneider Electric)
2026-07-10 18:29   ` sashiko-bot
2026-07-10 18:21 ` [PATCH v2 2/7] clk: tests: Add clk_parse_clkspec() Kunit testing Miquel Raynal (Schneider Electric)
2026-07-10 18:31   ` sashiko-bot [this message]
2026-07-10 18:21 ` [PATCH v2 3/7] clk: tests: Add Kunit testing for of_clk_get_parent_name() Miquel Raynal (Schneider Electric)
2026-07-10 18:21 ` [PATCH v2 4/7] clk: Improve a couple of comments Miquel Raynal (Schneider Electric)
2026-07-10 18:22 ` [PATCH v2 5/7] clk: Use the generic OF phandle parsing in only one place Miquel Raynal (Schneider Electric)
2026-07-10 18:36   ` sashiko-bot
2026-07-10 18:22 ` [PATCH v2 6/7] clk: Add support for clock nexus dt bindings Miquel Raynal (Schneider Electric)
2026-07-10 18:33   ` sashiko-bot
2026-07-10 18:22 ` [PATCH v2 7/7] clk: tests: Add Kunit testing for nexus nodes Miquel Raynal (Schneider Electric)
2026-07-12  8:18 ` [PATCH v2 0/7] clk: Add support for clock nexus Wolfram Sang

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=20260710183127.126261F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=miquel.raynal@bootlin.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