Re: [PATCH 40/45] clk: versatile: Make sure clk_init_data is fully initialized

Liviu Dudau <[email protected]>
Newsgroups dev.linux.lists.imx,dev.linux.lists.linux-sunxi,dev.linux.lists.soc,org.infradead.lists.linux-mediatek,org.kernel.vger.arm-scmi,org.kernel.vger.linux-clk,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mips,org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-samsung-soc,org.kernel.vger.linux-tegra,org.ozlabs.lists.linux-aspeed,org.ozlabs.lists.openbmc
Message-ID <aog2QXT_86BrtvTs@e142607>
On Fri, Aug 21, 2026 at 10:53:50AM +0200, 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]>

Reviewed-by: Liviu Dudau <[email protected]>

Best regards,
Liviu

> ---
> Compile-tested only.
> ---
>  drivers/clk/versatile/clk-icst.c         | 2 +-
>  drivers/clk/versatile/clk-sp810.c        | 2 +-
>  drivers/clk/versatile/clk-vexpress-osc.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
> index 6bd3db54dd229d28..97a1bfd6cf0ed995 100644
> --- a/drivers/clk/versatile/clk-icst.c
> +++ b/drivers/clk/versatile/clk-icst.c
> @@ -360,8 +360,8 @@ struct clk *icst_clk_setup(struct device *dev,
>  {
>  	struct clk *clk;
>  	struct clk_icst *icst;
> -	struct clk_init_data init;
>  	struct icst_params *pclone;
> +	struct clk_init_data init = {};
>  
>  	icst = kzalloc_obj(*icst);
>  	if (!icst)
> diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
> index b0e69686f7a9a93e..28e5c0cf1fda38e4 100644
> --- a/drivers/clk/versatile/clk-sp810.c
> +++ b/drivers/clk/versatile/clk-sp810.c
> @@ -86,7 +86,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
>  	const char *parent_names[2];
>  	int num = ARRAY_SIZE(parent_names);
>  	char name[12];
> -	struct clk_init_data init;
> +	struct clk_init_data init = {};
>  	static int instance;
>  	int i;
>  	bool deprecated;
> diff --git a/drivers/clk/versatile/clk-vexpress-osc.c b/drivers/clk/versatile/clk-vexpress-osc.c
> index 9adbf5c33bd1cada..72e872ec6b7c9b47 100644
> --- a/drivers/clk/versatile/clk-vexpress-osc.c
> +++ b/drivers/clk/versatile/clk-vexpress-osc.c
> @@ -64,7 +64,7 @@ static const struct clk_ops vexpress_osc_ops = {
>  
>  static int vexpress_osc_probe(struct platform_device *pdev)
>  {
> -	struct clk_init_data init;
> +	struct clk_init_data init = {};
>  	struct vexpress_osc *osc;
>  	u32 range[2];
>  	int ret;
> -- 
> 2.43.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
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.