Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: davinci: da8xx-cfgchip: Initialize clk_init_data before use

The flag attribute of the struct clk_init_data isn't initialized before
the devm_clk_hw_register() call. This can lead to unexpected behavior
during registration.

Initialize the entire clk_init_data to zero at declaration.

Cc: stable@vger.kernel.org
Fixes: 58e1e2d2cd89 ("clk: davinci: cfgchip: Add TI DA8XX USB PHY clocks")
Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: David Lechner <david@lechnology.com>
Link: https://lore.kernel.org/r/20240718115534.41513-1-bastien.curutchet@bootlin.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Bastien Curutchet and committed by
Stephen Boyd
a83b2275 589eb114

+2 -2
+2 -2
drivers/clk/davinci/da8xx-cfgchip.c
··· 508 508 const char * const parent_names[] = { "usb_refclkin", "pll0_auxclk" }; 509 509 struct clk *fck_clk; 510 510 struct da8xx_usb0_clk48 *usb0; 511 - struct clk_init_data init; 511 + struct clk_init_data init = {}; 512 512 int ret; 513 513 514 514 fck_clk = devm_clk_get(dev, "fck"); ··· 583 583 { 584 584 const char * const parent_names[] = { "usb0_clk48", "usb_refclkin" }; 585 585 struct da8xx_usb1_clk48 *usb1; 586 - struct clk_init_data init; 586 + struct clk_init_data init = {}; 587 587 int ret; 588 588 589 589 usb1 = devm_kzalloc(dev, sizeof(*usb1), GFP_KERNEL);