Skip to contentSkip to conversation

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

PATCH Applied Bastien Curutchet 2 participants 2 messages Jul 18, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

Fixes 58e1e2d2cd89 ("clk: davinci: cfgchip: Add TI DA8XX USB PHY clocks")

---
Changes in v2:
Add Cc and Fixes tags
Add Reviewed-by David

v1: https://lore.kernel.org/all/[email protected]/

 drivers/clk/davinci/da8xx-cfgchip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/davinci/da8xx-cfgchip.c +2 -2
index ad2d0df43dc6..ec60ecb517f1 100644
@@ -508,7 +508,7 @@ da8xx_cfgchip_register_usb0_clk48(struct device *dev,
 	const char * const parent_names[] = { "usb_refclkin", "pll0_auxclk" };
 	struct clk *fck_clk;
 	struct da8xx_usb0_clk48 *usb0;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	int ret;
 
 	fck_clk = devm_clk_get(dev, "fck");
@@ -583,7 +583,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev,
 {
 	const char * const parent_names[] = { "usb0_clk48", "usb_refclkin" };
 	struct da8xx_usb1_clk48 *usb1;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	int ret;
 
 	usb1 = devm_kzalloc(dev, sizeof(*usb1), GFP_KERNEL);
Signature · 1 line
2.45.0
maintainer Applied
#1 lore raw

Quoting Bastien Curutchet (2024-07-18 04:55:34)

Quoted 11 lines

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.

Fixes 58e1e2d2cd89 ("clk: davinci: cfgchip: Add TI DA8XX USB PHY clocks")

---

Applied to clk-next