[PATCH] i2c: bcm2835: Make sure clk_init_data is fully initialized
Geert Uytterhoeven <[email protected]>
| Newsgroups | org.kernel.vger.linux-i2c,org.kernel.vger.linux-clk |
|---|---|
| Message-ID | <9f82f37e6d6c069cd44326bcd5e5a2a8069a13a9.1787239980.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 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/[email protected] --- 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