diff mbox series

[3/4] clk: socfpga: arria10: Fix the use of uninitialized variable

Message ID 20241009063229.121258-4-zhangzekun11@huawei.com (mailing list archive)
State Under Review
Headers show
Series clk: Fix the use of uninitialized variable | expand

Commit Message

Zhang Zekun Oct. 9, 2024, 6:32 a.m. UTC
The of_property_read_u32() can fail and leave the variable uninitialized,
which will then be used. Return before using the uninitialized variable.

Fixes: 5343325ff3dd ("clk: socfpga: add a clock driver for the Arria 10 platform")
Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/clk/socfpga/clk-pll-a10.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/clk/socfpga/clk-pll-a10.c b/drivers/clk/socfpga/clk-pll-a10.c
index b028f25c658a..c01451400faa 100644
--- a/drivers/clk/socfpga/clk-pll-a10.c
+++ b/drivers/clk/socfpga/clk-pll-a10.c
@@ -76,7 +76,8 @@  static void __init __socfpga_pll_init(struct device_node *node,
 	int rc;
 	int i = 0;
 
-	of_property_read_u32(node, "reg", &reg);
+	if (of_property_read_u32(node, "reg", &reg))
+		return;
 
 	pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL);
 	if (WARN_ON(!pll_clk))