Message ID | 20241009063229.121258-4-zhangzekun11@huawei.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | clk: Fix the use of uninitialized variable | expand |
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", ®); + if (of_property_read_u32(node, "reg", ®)) + return; pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); if (WARN_ON(!pll_clk))
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(-)