[PATCH 21/45] clk: mxs: Make sure clk_init_data is fully initialized
Geert Uytterhoeven
geert+renesas at glider.be
Fri Aug 21 01:53:31 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/mxs/clk-div.c | 2 +-
drivers/clk/mxs/clk-frac.c | 2 +-
drivers/clk/mxs/clk-pll.c | 2 +-
drivers/clk/mxs/clk-ref.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/mxs/clk-div.c b/drivers/clk/mxs/clk-div.c
index fe7224162b3cc0fa..d4ee785c651190f0 100644
--- a/drivers/clk/mxs/clk-div.c
+++ b/drivers/clk/mxs/clk-div.c
@@ -70,9 +70,9 @@ static const struct clk_ops clk_div_ops = {
struct clk *mxs_clk_div(const char *name, const char *parent_name,
void __iomem *reg, u8 shift, u8 width, u8 busy)
{
+ struct clk_init_data init = {};
struct clk_div *div;
struct clk *clk;
- struct clk_init_data init;
div = kzalloc_obj(*div);
if (!div)
diff --git a/drivers/clk/mxs/clk-frac.c b/drivers/clk/mxs/clk-frac.c
index 52eb82fde322dcc4..e317710ab503a84a 100644
--- a/drivers/clk/mxs/clk-frac.c
+++ b/drivers/clk/mxs/clk-frac.c
@@ -112,9 +112,9 @@ static const struct clk_ops clk_frac_ops = {
struct clk *mxs_clk_frac(const char *name, const char *parent_name,
void __iomem *reg, u8 shift, u8 width, u8 busy)
{
+ struct clk_init_data init = {};
struct clk_frac *frac;
struct clk *clk;
- struct clk_init_data init;
frac = kzalloc_obj(*frac);
if (!frac)
diff --git a/drivers/clk/mxs/clk-pll.c b/drivers/clk/mxs/clk-pll.c
index 581868e0693c6e5e..5acf48cddbb2859f 100644
--- a/drivers/clk/mxs/clk-pll.c
+++ b/drivers/clk/mxs/clk-pll.c
@@ -82,9 +82,9 @@ static const struct clk_ops clk_pll_ops = {
struct clk *mxs_clk_pll(const char *name, const char *parent_name,
void __iomem *base, u8 power, unsigned long rate)
{
+ struct clk_init_data init = {};
struct clk_pll *pll;
struct clk *clk;
- struct clk_init_data init;
pll = kzalloc_obj(*pll);
if (!pll)
diff --git a/drivers/clk/mxs/clk-ref.c b/drivers/clk/mxs/clk-ref.c
index 9667d4d3c2a885eb..66ea1c229014ed60 100644
--- a/drivers/clk/mxs/clk-ref.c
+++ b/drivers/clk/mxs/clk-ref.c
@@ -113,9 +113,9 @@ static const struct clk_ops clk_ref_ops = {
struct clk *mxs_clk_ref(const char *name, const char *parent_name,
void __iomem *reg, u8 idx)
{
+ struct clk_init_data init = {};
struct clk_ref *ref;
struct clk *clk;
- struct clk_init_data init;
ref = kzalloc_obj(*ref);
if (!ref)
--
2.43.0
More information about the Linux-mediatek
mailing list