[PATCH 38/45] clk: uniphier: Make sure clk_init_data is fully initialized
Geert Uytterhoeven
geert+renesas at glider.be
Fri Aug 21 01:53:48 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>
---
Compile-tested only.
---
drivers/clk/uniphier/clk-uniphier-cpugear.c | 2 +-
drivers/clk/uniphier/clk-uniphier-fixed-factor.c | 2 +-
drivers/clk/uniphier/clk-uniphier-fixed-rate.c | 2 +-
drivers/clk/uniphier/clk-uniphier-gate.c | 2 +-
drivers/clk/uniphier/clk-uniphier-mux.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/uniphier/clk-uniphier-cpugear.c b/drivers/clk/uniphier/clk-uniphier-cpugear.c
index a2f01a4da1276903..165c6832b722faa9 100644
--- a/drivers/clk/uniphier/clk-uniphier-cpugear.c
+++ b/drivers/clk/uniphier/clk-uniphier-cpugear.c
@@ -79,7 +79,7 @@ struct clk_hw *uniphier_clk_register_cpugear(struct device *dev,
const struct uniphier_clk_cpugear_data *data)
{
struct uniphier_clk_cpugear *gear;
- struct clk_init_data init;
+ struct clk_init_data init = {};
int ret;
gear = devm_kzalloc(dev, sizeof(*gear), GFP_KERNEL);
diff --git a/drivers/clk/uniphier/clk-uniphier-fixed-factor.c b/drivers/clk/uniphier/clk-uniphier-fixed-factor.c
index a6a37a6bca3ab047..c86683fce20549d9 100644
--- a/drivers/clk/uniphier/clk-uniphier-fixed-factor.c
+++ b/drivers/clk/uniphier/clk-uniphier-fixed-factor.c
@@ -13,8 +13,8 @@ struct clk_hw *uniphier_clk_register_fixed_factor(struct device *dev,
const char *name,
const struct uniphier_clk_fixed_factor_data *data)
{
+ struct clk_init_data init = {};
struct clk_fixed_factor *fix;
- struct clk_init_data init;
int ret;
fix = devm_kzalloc(dev, sizeof(*fix), GFP_KERNEL);
diff --git a/drivers/clk/uniphier/clk-uniphier-fixed-rate.c b/drivers/clk/uniphier/clk-uniphier-fixed-rate.c
index 3bc55ab75314bf8d..63f49d3bab80bae8 100644
--- a/drivers/clk/uniphier/clk-uniphier-fixed-rate.c
+++ b/drivers/clk/uniphier/clk-uniphier-fixed-rate.c
@@ -13,8 +13,8 @@ struct clk_hw *uniphier_clk_register_fixed_rate(struct device *dev,
const char *name,
const struct uniphier_clk_fixed_rate_data *data)
{
+ struct clk_init_data init = {};
struct clk_fixed_rate *fixed;
- struct clk_init_data init;
int ret;
/* allocate fixed-rate clock */
diff --git a/drivers/clk/uniphier/clk-uniphier-gate.c b/drivers/clk/uniphier/clk-uniphier-gate.c
index e58093e79dd7dc23..9f49e6bb6b2042f7 100644
--- a/drivers/clk/uniphier/clk-uniphier-gate.c
+++ b/drivers/clk/uniphier/clk-uniphier-gate.c
@@ -61,8 +61,8 @@ struct clk_hw *uniphier_clk_register_gate(struct device *dev,
const char *name,
const struct uniphier_clk_gate_data *data)
{
+ struct clk_init_data init = {};
struct uniphier_clk_gate *gate;
- struct clk_init_data init;
int ret;
gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL);
diff --git a/drivers/clk/uniphier/clk-uniphier-mux.c b/drivers/clk/uniphier/clk-uniphier-mux.c
index 1998e9d4cfc0224a..a63ad4df8e65ebcf 100644
--- a/drivers/clk/uniphier/clk-uniphier-mux.c
+++ b/drivers/clk/uniphier/clk-uniphier-mux.c
@@ -58,8 +58,8 @@ struct clk_hw *uniphier_clk_register_mux(struct device *dev,
const char *name,
const struct uniphier_clk_mux_data *data)
{
+ struct clk_init_data init = {};
struct uniphier_clk_mux *mux;
- struct clk_init_data init;
int ret;
mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL);
--
2.43.0
More information about the Linux-mediatek
mailing list