From: Chuan Liu <chuan.liu@amlogic.com>
To: Stephen Boyd <sboyd@kernel.org>,
Chuan Liu via B4 Relay <devnull+chuan.liu.amlogic.com@kernel.org>,
Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: Add fault tolerance to of_clk_hw_onecell_get()
Date: Tue, 5 Aug 2025 14:13:09 +0800 [thread overview]
Message-ID: <e2d67fbb-7b27-4340-b811-cadc01618a44@amlogic.com> (raw)
In-Reply-To: <175398035351.3513.14541914855277799230@lazor>
Hi Stephen:
After reviewing all CCF drivers referencing of_clk_hw_onecell_get(),
I confirmed their corresponding binding *.yaml files define
'#clock-cells' as 'const: 1'.
Therefore, the case I previously described is currently disallowed.
Please ignore this patch. Thanks.
On 8/1/2025 12:45 AM, Stephen Boyd wrote:
> [ EXTERNAL EMAIL ]
>
> 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.
prev parent reply other threads:[~2025-08-05 6:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-31 12:39 [PATCH] clk: Add fault tolerance to of_clk_hw_onecell_get() Chuan Liu via B4 Relay
2025-07-31 16:45 ` Stephen Boyd
2025-08-01 2:40 ` Chuan Liu
2025-08-05 6:13 ` Chuan Liu [this message]
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=e2d67fbb-7b27-4340-b811-cadc01618a44@amlogic.com \
--to=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 \
--cc=sboyd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).