* [PATCH] MIPS: Alchemy: clock: Make sure clk_init_data is fully initialized
@ 2026-08-21 10:05 Geert Uytterhoeven
2026-08-24 15:20 ` Brian Masney
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2026-08-21 10:05 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips, linux-clk, Geert Uytterhoeven
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@glider.be>
---
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/cover.1787165329.git.geert+renesas@glider.be
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MIPS: Alchemy: clock: Make sure clk_init_data is fully initialized
2026-08-21 10:05 [PATCH] MIPS: Alchemy: clock: Make sure clk_init_data is fully initialized Geert Uytterhoeven
@ 2026-08-24 15:20 ` Brian Masney
0 siblings, 0 replies; 2+ messages in thread
From: Brian Masney @ 2026-08-24 15:20 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Thomas Bogendoerfer, linux-mips, linux-clk
On Fri, Aug 21, 2026 at 12:05:15PM +0200, Geert Uytterhoeven wrote:
> 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@glider.be>
Reviewed-by: Brian Masney <bmasney@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-24 15:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 10:05 [PATCH] MIPS: Alchemy: clock: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-24 15:20 ` Brian Masney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox