Message ID | 20241009063229.121258-5-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.c b/drivers/clk/socfpga/clk-pll.c index 9dcc1b2d2cc0..9c3ce45cb907 100644 --- a/drivers/clk/socfpga/clk-pll.c +++ b/drivers/clk/socfpga/clk-pll.c @@ -82,7 +82,8 @@ static void __init __socfpga_pll_init(struct device_node *node, struct device_node *clkmgr_np; int rc; - 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: 97259e99bdc9 ("clk: socfpga: split clk code") Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> --- drivers/clk/socfpga/clk-pll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)