Re: [PATCH net-next 1/3] net: macb: Make sure clk_init_data is fully initialized

Théo Lebrun <[email protected]>
Newsgroups org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-amlogic,org.kernel.vger.linux-clk,org.kernel.vger.netdev
Message-ID <[email protected]>
Hello Geert,

On Fri Aug 21, 2026 at 12:07 PM CEST, Geert Uytterhoeven wrote:
> The clk_init_data structure contains several mutually-exclusive members
> for different methods to specify the possible parents of a clock,
> prompting drivers to initialize only the members they need.  However,
> not initializing all members may cause subtle issues, which are only
> exposed when CONFIG_INIT_STACK_ALL_PATTERN or CONFIG_INIT_STACK_NONE is
> enabled.
>
> Make sure all members are fully initialized, to avoid such bugs, and to
> prevent future breakage when converting drivers to a different method
> for specifying the parents.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> Compile-tested only.
> ---
>  drivers/net/ethernet/cadence/macb_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 1476bce77f34d2a5..319e43098f57ed7b 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -5376,7 +5376,7 @@ static int fu540_c000_clk_init(struct platform_device *pdev, struct clk **pclk,
>  			       struct clk **hclk, struct clk **tx_clk,
>  			       struct clk **rx_clk, struct clk **tsu_clk)
>  {
> -	struct clk_init_data init;
> +	struct clk_init_data init = {};
>  	int err = 0;
>  
>  	err = macb_clk_init_dflt(pdev, pclk, hclk, tx_clk, rx_clk, tsu_clk);

Reviewed-by: Théo Lebrun <[email protected]>

I cannot give you a Tested-by because this triggers only on
sifive,fu540-c000-gem compatible matching upstream devicetrees
sifive/hifive-{unleashed,unmatched}-a00.dts

Thanks,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.