Re: [PATCH v7 3/9] clk: fixed-factor: Rework initialization with parent clocks

From: Brian Masney

Date: Tue May 26 2026 - 14:01:50 EST


On Fri, May 22, 2026 at 02:31:12PM +0200, Benoît Monin wrote:
> Use the same sequence as clk-divider, clk-gate and other to set the
> parent_names, parent_hws and parent_data in the init struct when
> registering a fixed-factor clock. The number of parent clocks is now
> only set to one if a parent clock is provided.
>
> Previously the number of parent clocks was always one, forcing callers
> of __clk_hw_register_fixed_factor() to provide a dummy parent_data
> struct with an invalid clock index in case they were not provided with
> a non-NULL parent_name or parent_hw. Drop this dummy parent_data as is
> not necessary anymore.
>
> This change only has a small impact on mis-configured fixed-factor. Now a
> call to clk_hw_register_fixed_factor() with a NULL parent will register
> a fixed-factor with zero parent while previously it was registered with
> one invalid parent. In both cases the rate of the fixed-factor is 0Hz
> but it is no longer shown as orphaned.
>
> This has no impact on properly configured fixed-factors clocks which
> have a valid parent set.
>
> In clk_factor_determine_rate(), make sure the parent clock is valid
> before accessing it because the mis-configured fixed-factor now have a
> NULL parent.
>
> Signed-off-by: Benoît Monin <benoit.monin@xxxxxxxxxxx>

Reviewed-by: Brian Masney <bmasney@xxxxxxxxxx>