* [PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized
@ 2026-08-21 10:03 Geert Uytterhoeven
2026-08-24 15:16 ` Brian Masney
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-08-21 10:03 UTC (permalink / raw)
To: Florian Fainelli, Broadcom internal kernel review list,
Andi Shyti
Cc: linux-i2c, 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 I2C 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
---
drivers/i2c/busses/i2c-bcm2835.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 0d7e2654a534e92a..b30f7e0e45f160c2 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -166,7 +166,7 @@ static struct clk *bcm2835_i2c_register_div(struct device *dev,
struct clk *mclk,
struct bcm2835_i2c_dev *i2c_dev)
{
- struct clk_init_data init;
+ struct clk_init_data init = {};
struct clk_bcm2835_i2c *priv;
char name[32];
const char *mclk_name;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized
2026-08-21 10:03 [PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized Geert Uytterhoeven
@ 2026-08-24 15:16 ` Brian Masney
2026-08-24 16:17 ` Florian Fainelli
2026-08-28 2:08 ` Andi Shyti
2 siblings, 0 replies; 4+ messages in thread
From: Brian Masney @ 2026-08-24 15:16 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Florian Fainelli, Broadcom internal kernel review list,
Andi Shyti, linux-i2c, linux-clk
On Fri, Aug 21, 2026 at 12:03:30PM +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] 4+ messages in thread
* Re: [PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized
2026-08-21 10:03 [PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-24 15:16 ` Brian Masney
@ 2026-08-24 16:17 ` Florian Fainelli
2026-08-28 2:08 ` Andi Shyti
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2026-08-24 16:17 UTC (permalink / raw)
To: Geert Uytterhoeven, Broadcom internal kernel review list,
Andi Shyti
Cc: linux-i2c, linux-clk
On 8/21/26 03:03, 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: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized
2026-08-21 10:03 [PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-24 15:16 ` Brian Masney
2026-08-24 16:17 ` Florian Fainelli
@ 2026-08-28 2:08 ` Andi Shyti
2 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2026-08-28 2:08 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Florian Fainelli, Broadcom internal kernel review list, linux-i2c,
linux-clk
Hi Geert,
On Fri, Aug 21, 2026 at 12:03:30PM +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>
merged to i2c/i2c.
Thanks,
Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-28 2:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 10:03 [PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-24 15:16 ` Brian Masney
2026-08-24 16:17 ` Florian Fainelli
2026-08-28 2:08 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox