From 605757e1771357a97710f1e3cdedaa739a283cda Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Fri, 21 Aug 2026 10:53:44 +0200 Subject: [PATCH] clk: stm32: Make sure clk_init_data is fully initialized 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 Message-ID: <0b80535e9cfdc96d43169e5023e3a92a8f2252d6.1787239813.git.geert+renesas@glider.be> Signed-off-by: Brian Masney --- drivers/clk/clk-stm32f4.c | 4 ++-- drivers/clk/clk-stm32h7.c | 2 +- drivers/clk/stm32/clk-stm32mp1.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index 565b4d99bebb..6603d4815514 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c @@ -485,8 +485,8 @@ static struct clk *clk_register_apb_mul(struct device *dev, const char *name, const char *parent_name, unsigned long flags, u8 bit_idx) { + struct clk_init_data init = {}; struct clk_apb_mul *am; - struct clk_init_data init; struct clk *clk; am = kzalloc_obj(*am); @@ -810,8 +810,8 @@ static struct clk_hw *clk_register_pll_div(const char *name, struct clk_hw *pll_hw, spinlock_t *lock) { struct stm32f4_pll_div *pll_div; + struct clk_init_data init = {}; struct clk_hw *hw; - struct clk_init_data init; int ret; /* allocate the divider */ diff --git a/drivers/clk/clk-stm32h7.c b/drivers/clk/clk-stm32h7.c index 82e0789cf189..c6afa9b20235 100644 --- a/drivers/clk/clk-stm32h7.c +++ b/drivers/clk/clk-stm32h7.c @@ -462,8 +462,8 @@ static struct clk_hw *clk_register_stm32_timer_ker(struct device *dev, u8 dppre_shift, spinlock_t *lock) { + struct clk_init_data init = {}; struct timer_ker *element; - struct clk_init_data init; struct clk_hw *hw; int err; diff --git a/drivers/clk/stm32/clk-stm32mp1.c b/drivers/clk/stm32/clk-stm32mp1.c index 2d9ccd96ec98..b265e3f3e94c 100644 --- a/drivers/clk/stm32/clk-stm32mp1.c +++ b/drivers/clk/stm32/clk-stm32mp1.c @@ -902,8 +902,8 @@ static struct clk_hw *clk_register_pll(struct device *dev, const char *name, unsigned long flags, spinlock_t *lock) { + struct clk_init_data init = {}; struct stm32_pll_obj *element; - struct clk_init_data init; struct clk_hw *hw; int err; @@ -1041,8 +1041,8 @@ static struct clk_hw *clk_register_cktim(struct device *dev, const char *name, void __iomem *timpre, spinlock_t *lock) { + struct clk_init_data init = {}; struct timer_cker *tim_ker; - struct clk_init_data init; struct clk_hw *hw; int err;