mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Chuan Liu via B4 Relay <devnull+chuan.liu.amlogic.com@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	chuan.liu@amlogic.com
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chuan Liu <chuan.liu@amlogic.com>
Subject: Re: [PATCH] clk: Add fault tolerance to of_clk_hw_onecell_get()
Date: Thu, 31 Jul 2025 09:45:53 -0700	[thread overview]
Message-ID: <175398035351.3513.14541914855277799230@lazor> (raw)
In-Reply-To: <20250731-add_fault_tolerance_to_of_clk_hw_onecell_get-v1-1-886214fab4a7@amlogic.com>

Quoting Chuan Liu via B4 Relay (2025-07-31 05:39:58)
> From: Chuan Liu <chuan.liu@amlogic.com>
> 
> In specific cases, even a clk_provider managing only a single clock may
> reference of_clk_hw_onecell_get() to access its member clocks, as seen
> in implementations like clk-scmi.
> 
> For a clk_provider with only one clock, when calling
> of_parse_phandle_with_args(), the phandle_args->args[] members are not
> assigned. In this case, the reference to phandle_args->args[0] in
> of_clk_hw_onecell_get() becomes invalid. If phandle_args->args[0]
> initially contains a non-zero value, this will trigger an error.
> 
> Signed-off-by: Chuan Liu <chuan.liu@amlogic.com>
> ---
> Error conditions observed:
> 
> scmi_clk: protocol@14 {
>         reg = <0x14>;
>         #clock-cells = <0>;
> };
> 
> phandle1: clock-controller@1 {
>         #clock-cells = <1>;
> }
> 
> clock-consumer@2 {
>         assigned-clocks = <&phandle1 1>,
>                           <&scmi_clk>;
>         assigned-clock-rates = <xxx>,
>                                <xxx>;
> }
> 
> Under these conditions, executing of_clk_set_defaults() triggers the
> error: 'of_clk_hw_onecell_get: invalid index 1'.

Please write a KUnit test.

  reply	other threads:[~2025-07-31 16:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 12:39 Chuan Liu via B4 Relay
2025-07-31 16:45 ` Stephen Boyd [this message]
2025-08-01  2:40   ` Chuan Liu
2025-08-05  6:13   ` Chuan 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=175398035351.3513.14541914855277799230@lazor \
    --to=sboyd@kernel.org \
    --cc=chuan.liu@amlogic.com \
    --cc=devnull+chuan.liu.amlogic.com@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.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

all inboxes | Powered by JetHome®