[PATCH 27/45] clk: renesas: Make sure clk_init_data is fully initialized
Geert Uytterhoeven
geert+renesas at glider.be
Fri Aug 21 01:53:37 PDT 2026
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 at glider.be>
---
Boot-tested on RZ/Five.
---
drivers/clk/renesas/rzg2l-cpg.c | 18 +++++++++---------
drivers/clk/renesas/rzv2h-cpg.c | 8 ++++----
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index 88d74858687d4866..50b64eb3eafebe71 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -580,7 +580,7 @@ rzg2l_cpg_sd_mux_clk_register(const struct cpg_core_clk *core,
struct rzg2l_cpg_priv *priv)
{
struct sd_mux_hw_data *sd_mux_hw_data;
- struct clk_init_data init;
+ struct clk_init_data init = {};
struct clk_hw *clk_hw;
int ret;
@@ -831,9 +831,9 @@ rzg2l_cpg_dsi_div_clk_register(const struct cpg_core_clk *core,
struct rzg2l_cpg_priv *priv)
{
struct dsi_div_hw_data *clk_hw_data;
+ struct clk_init_data init = {};
const struct clk *parent;
const char *parent_name;
- struct clk_init_data init;
struct clk_hw *clk_hw;
int ret;
@@ -916,8 +916,8 @@ static struct clk * __init
rzg3l_cpg_lvds_div_clk_register(const struct cpg_core_clk *core,
struct rzg2l_cpg_priv *priv)
{
+ struct clk_init_data init = {};
struct clk_fixed_factor *ff;
- struct clk_init_data init;
const struct clk *parent;
const char *parent_name;
int ret;
@@ -1031,9 +1031,9 @@ rzg3l_cpg_dsi_div_clk_register(const struct cpg_core_clk *core,
struct rzg2l_cpg_priv *priv)
{
struct g3l_dsi_div_hw_data *clk_hw_data;
+ struct clk_init_data init = {};
const struct clk *parent;
const char *parent_name;
- struct clk_init_data init;
struct clk_hw *clk_hw;
int ret;
@@ -1128,7 +1128,7 @@ rzg2l_cpg_pll5_4_mux_clk_register(const struct cpg_core_clk *core,
struct rzg2l_cpg_priv *priv)
{
struct pll5_mux_hw_data *clk_hw_data;
- struct clk_init_data init;
+ struct clk_init_data init = {};
struct clk_hw *clk_hw;
int ret;
@@ -1255,8 +1255,8 @@ static struct clk * __init
rzg2l_cpg_sipll5_register(const struct cpg_core_clk *core,
struct rzg2l_cpg_priv *priv)
{
+ struct clk_init_data init = {};
const struct clk *parent;
- struct clk_init_data init;
const char *parent_name;
struct sipll5 *sipll5;
struct clk_hw *clk_hw;
@@ -1381,9 +1381,9 @@ rzg2l_cpg_pll_clk_register(const struct cpg_core_clk *core,
struct rzg2l_cpg_priv *priv,
const struct clk_ops *ops)
{
+ struct clk_init_data init = {};
struct device *dev = priv->dev;
const struct clk *parent;
- struct clk_init_data init;
const char *parent_name;
struct pll_clk *pll_clk;
int ret;
@@ -1525,8 +1525,8 @@ static struct clk * __init
rzg3l_cpg_dsi_mux_clk_register(const struct cpg_core_clk *core,
struct rzg2l_cpg_priv *priv)
{
+ struct clk_init_data init = {};
struct clk_mux *mux_data;
- struct clk_init_data init;
int ret;
mux_data = devm_kzalloc(priv->dev, sizeof(*mux_data), GFP_KERNEL);
@@ -2265,10 +2265,10 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod,
const struct rzg2l_cpg_info *info,
struct rzg2l_cpg_priv *priv)
{
+ struct clk_init_data init = {};
struct mod_clock *clock = NULL;
struct device *dev = priv->dev;
unsigned int id = mod->id;
- struct clk_init_data init;
struct clk *parent, *clk;
const char *parent_name;
unsigned int i;
diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cpg.c
index 917fc737f254b916..7003d59ac34b1179 100644
--- a/drivers/clk/renesas/rzv2h-cpg.c
+++ b/drivers/clk/renesas/rzv2h-cpg.c
@@ -338,7 +338,7 @@ rzv2h_cpg_plldsi_div_clk_register(const struct cpg_core_clk *core,
{
struct rzv2h_plldsi_div_clk *clk_hw_data;
struct clk **clks = priv->clks;
- struct clk_init_data init;
+ struct clk_init_data init = {};
const struct clk *parent;
const char *parent_name;
struct clk_hw *clk_hw;
@@ -582,7 +582,7 @@ rzv2h_cpg_plldsi_smux_clk_register(const struct cpg_core_clk *core,
struct rzv2h_cpg_priv *priv)
{
struct rzv2h_plldsi_mux_clk *clk_hw_data;
- struct clk_init_data init;
+ struct clk_init_data init = {};
struct clk_hw *clk_hw;
struct smuxed smux;
int ret;
@@ -711,7 +711,7 @@ rzv2h_cpg_pll_clk_register(const struct cpg_core_clk *core,
const struct clk_ops *ops)
{
struct device *dev = priv->dev;
- struct clk_init_data init;
+ struct clk_init_data init = {};
const struct clk *parent;
const char *parent_name;
struct pll_clk *pll_clk;
@@ -1229,7 +1229,7 @@ rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod,
{
struct mod_clock *clock = NULL;
struct device *dev = priv->dev;
- struct clk_init_data init;
+ struct clk_init_data init = {};
struct clk *parent, *clk;
const char *parent_name;
unsigned int id;
--
2.43.0
More information about the Linux-mediatek
mailing list