[PATCH] MIPS: Alchemy: clock: Make sure clk_init_data is fully initialized
Geert Uytterhoeven <[email protected]>
| Newsgroups | org.kernel.vger.linux-clk,org.kernel.vger.linux-mips |
|---|---|
| Message-ID | <3610b51df642abb1fbb39f5bd93fddea43f8f164.1787240060.git.geert+renesas@glider.be> |
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 <[email protected]> --- Compile-tested only. Part One[1] fixed all cases that I identified to be real bugs, in response to a crash I saw on BeagleBone Black. This patch is the MIPS 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. [1] "[PATCH treewide 0/5] clk: Make sure clk_init_data is fully initialized (part 1)" https://lore.kernel.org/[email protected] --- arch/mips/alchemy/common/clock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c index 62a7304ff35f6190..b5d2cbb7c69ec475 100644 --- a/arch/mips/alchemy/common/clock.c +++ b/arch/mips/alchemy/common/clock.c @@ -150,7 +150,7 @@ static const struct clk_ops alchemy_clkops_cpu = { static struct clk __init *alchemy_clk_setup_cpu(const char *parent_name, int ctype) { - struct clk_init_data id; + struct clk_init_data id = {}; struct clk_hw *h; struct clk *clk; @@ -245,7 +245,7 @@ static struct clk __init *alchemy_clk_setup_aux(const char *parent_name, char *name, int maxmult, unsigned long reg) { - struct clk_init_data id; + struct clk_init_data id = {}; struct clk *c; struct alchemy_auxpll_clk *a; @@ -754,7 +754,7 @@ static const char * const alchemy_clk_fgen_names[] = { static int __init alchemy_clk_init_fgens(int ctype) { struct clk *c; - struct clk_init_data id; + struct clk_init_data id = {}; struct alchemy_fgcs_clk *a; unsigned long v; int i, ret; @@ -959,9 +959,9 @@ static int alchemy_csrc_dt2[] = { 1, 4, 3, 2 }; /* Au1300 */ static int __init alchemy_clk_setup_imux(int ctype) { + struct clk_init_data id = {}; struct alchemy_fgcs_clk *a; const char * const *names; - struct clk_init_data id; unsigned long v; int i, ret, *dt; struct clk *c; -- 2.43.0