Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ARM/soc: Make sure clk_init_data is fully initialized
@ 2026-08-21  8:52 Geert Uytterhoeven
  2026-08-21  8:52 ` [PATCH 1/2] ARM: versatile: clock: " Geert Uytterhoeven
  2026-08-21  8:52 ` [PATCH 2/2] soc/tegra: pmc: " Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2026-08-21  8:52 UTC (permalink / raw)
  To: Liviu Dudau, Sudeep Holla, Lorenzo Pieralisi, Linus Walleij,
	Russell King, Thierry Reding, Jonathan Hunter
  Cc: linux-arm-kernel, linux-tegra, linux-clk, Geert Uytterhoeven

	Hi all,

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.

Hence this series aims to 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.

Part One[1] fixed all cases that I identified to be real bugs, in
response to a crash I saw on BeagleBone Black.

This series is the ARM/soc subpart of Part Two, which fixes remaining
cases that are currently harmless.  These are still fragile, and may
cause future breakage when converting drivers to a different method for
specifying the parents.

Thanks for your comments!

[1] "[PATCH treewide 0/5] clk: Make sure clk_init_data is fully
     initialized (part 1)"
    https://lore.kernel.org/cover.1787165329.git.geert+renesas@glider.be

Geert Uytterhoeven (2):
  ARM: versatile: clock: Make sure clk_init_data is fully initialized
  soc/tegra: pmc: Make sure clk_init_data is fully initialized

 arch/arm/mach-versatile/spc.c | 2 +-
 drivers/soc/tegra/pmc.c       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] ARM: versatile: clock: Make sure clk_init_data is fully initialized
  2026-08-21  8:52 [PATCH 0/2] ARM/soc: Make sure clk_init_data is fully initialized Geert Uytterhoeven
@ 2026-08-21  8:52 ` Geert Uytterhoeven
  2026-08-21 10:59   ` Liviu Dudau
  2026-08-21 12:37   ` Linus Walleij
  2026-08-21  8:52 ` [PATCH 2/2] soc/tegra: pmc: " Geert Uytterhoeven
  1 sibling, 2 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2026-08-21  8:52 UTC (permalink / raw)
  To: Liviu Dudau, Sudeep Holla, Lorenzo Pieralisi, Linus Walleij,
	Russell King, Thierry Reding, Jonathan Hunter
  Cc: linux-arm-kernel, linux-tegra, linux-clk, Geert Uytterhoeven

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 <geert+renesas@glider.be>
---
Compile-tested only.
---
 arch/arm/mach-versatile/spc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-versatile/spc.c b/arch/arm/mach-versatile/spc.c
index 7c3191aa3e12d1f3..d3f84819532fa498 100644
--- a/arch/arm/mach-versatile/spc.c
+++ b/arch/arm/mach-versatile/spc.c
@@ -522,7 +522,7 @@ static struct clk_ops clk_spc_ops = {
 
 static struct clk *ve_spc_clk_register(struct device *cpu_dev)
 {
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct clk_spc *spc;
 
 	spc = kzalloc_obj(*spc);
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] soc/tegra: pmc: Make sure clk_init_data is fully initialized
  2026-08-21  8:52 [PATCH 0/2] ARM/soc: Make sure clk_init_data is fully initialized Geert Uytterhoeven
  2026-08-21  8:52 ` [PATCH 1/2] ARM: versatile: clock: " Geert Uytterhoeven
@ 2026-08-21  8:52 ` Geert Uytterhoeven
  1 sibling, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2026-08-21  8:52 UTC (permalink / raw)
  To: Liviu Dudau, Sudeep Holla, Lorenzo Pieralisi, Linus Walleij,
	Russell King, Thierry Reding, Jonathan Hunter
  Cc: linux-arm-kernel, linux-tegra, linux-clk, Geert Uytterhoeven

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 <geert+renesas@glider.be>
---
Compile-tested only.
---
 drivers/soc/tegra/pmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 41ed716d5857317d..c42e28fe2b8b0ff9 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -2694,7 +2694,7 @@ tegra_pmc_clk_out_register(struct tegra_pmc *pmc,
 			   const struct pmc_clk_init_data *data,
 			   unsigned long offset)
 {
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct pmc_clk *pmc_clk;
 
 	pmc_clk = devm_kzalloc(pmc->dev, sizeof(*pmc_clk), GFP_KERNEL);
@@ -2752,7 +2752,7 @@ tegra_pmc_clk_gate_register(struct tegra_pmc *pmc, const char *name,
 			    const char *parent_name, unsigned long offset,
 			    u32 shift)
 {
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct pmc_clk_gate *gate;
 
 	gate = devm_kzalloc(pmc->dev, sizeof(*gate), GFP_KERNEL);
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ARM: versatile: clock: Make sure clk_init_data is fully initialized
  2026-08-21  8:52 ` [PATCH 1/2] ARM: versatile: clock: " Geert Uytterhoeven
@ 2026-08-21 10:59   ` Liviu Dudau
  2026-08-21 12:37   ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Liviu Dudau @ 2026-08-21 10:59 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Sudeep Holla, Lorenzo Pieralisi, Linus Walleij, Russell King,
	Thierry Reding, Jonathan Hunter, linux-arm-kernel, linux-tegra,
	linux-clk

On Fri, Aug 21, 2026 at 10:52:24AM +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 <geert+renesas@glider.be>

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu

> ---
> Compile-tested only.
> ---
>  arch/arm/mach-versatile/spc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-versatile/spc.c b/arch/arm/mach-versatile/spc.c
> index 7c3191aa3e12d1f3..d3f84819532fa498 100644
> --- a/arch/arm/mach-versatile/spc.c
> +++ b/arch/arm/mach-versatile/spc.c
> @@ -522,7 +522,7 @@ static struct clk_ops clk_spc_ops = {
>  
>  static struct clk *ve_spc_clk_register(struct device *cpu_dev)
>  {
> -	struct clk_init_data init;
> +	struct clk_init_data init = {};
>  	struct clk_spc *spc;
>  
>  	spc = kzalloc_obj(*spc);
> -- 
> 2.43.0
> 

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ARM: versatile: clock: Make sure clk_init_data is fully initialized
  2026-08-21  8:52 ` [PATCH 1/2] ARM: versatile: clock: " Geert Uytterhoeven
  2026-08-21 10:59   ` Liviu Dudau
@ 2026-08-21 12:37   ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2026-08-21 12:37 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Liviu Dudau, Sudeep Holla, Lorenzo Pieralisi, Russell King,
	Thierry Reding, Jonathan Hunter, linux-arm-kernel, linux-tegra,
	linux-clk

On Fri, Aug 21, 2026 at 10:52 AM Geert Uytterhoeven
<geert+renesas@glider.be> 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 <geert+renesas@glider.be>

Looks right to me:
Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-21 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  8:52 [PATCH 0/2] ARM/soc: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-21  8:52 ` [PATCH 1/2] ARM: versatile: clock: " Geert Uytterhoeven
2026-08-21 10:59   ` Liviu Dudau
2026-08-21 12:37   ` Linus Walleij
2026-08-21  8:52 ` [PATCH 2/2] soc/tegra: pmc: " Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox