[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250613-congenial-tamarin-of-experience-cb2598@sudeepholla>
Date: Fri, 13 Jun 2025 14:43:35 +0100
From: Sudeep Holla <sudeep.holla@....com>
To: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Cristian Marussi <cristian.marussi@....com>,
Sudeep Holla <sudeep.holla@....com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Peng Fan <peng.fan@....com>,
<arm-scmi@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-clk@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] clk: scmi: Handle case where child clocks are
initialized before their parents
On Thu, Jun 12, 2025 at 02:56:57PM +0200, Sascha Hauer wrote:
> The SCMI clock driver currently assumes that parent clocks are always
> initialized before their children. However, this assumption can fail if
> a child clock is encountered before its parent during probe.
>
> This leads to an issue during initialization of the parent_data array:
>
> sclk->parent_data[i].hw = hws[sclk->info->parents[i]];
>
> If the parent clock's hardware structure has not been initialized yet,
> this assignment results in invalid data.
>
> To resolve this, allocate all struct scmi_clk instances as a contiguous
> array at the beginning of the probe and populate the hws[] array
> upfront. This ensures that any parent referenced later is already
> initialized, regardless of the order in which clocks are processed.
>
> Note that we can no longer free individual scmi_clk instances if
> scmi_clk_ops_init() fails which shouldn't be a problem if the SCMI
> platform has proper per-agent clock discovery.
>
> Fixes: 65a8a3dd3b95f ("clk: scmi: Add support for clock {set,get}_parent")
> Reviewed-by: peng.fan@....com
> Reviewed-by: Cristian Marussi <cristian.marussi@....com>
> Reviewed-by: Sudeep Holla <sudeep.holla@....com>
Mike/Stephen,
Please pick this up in your next round of fixes.
--
Regards,
Sudeep
Powered by blists - more mailing lists