Message ID | 20241009063229.121258-3-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-periph.c b/drivers/clk/socfpga/clk-periph.c index 6a4075147b9c..ec4234d9daa1 100644 --- a/drivers/clk/socfpga/clk-periph.c +++ b/drivers/clk/socfpga/clk-periph.c @@ -60,7 +60,8 @@ static void __init __socfpga_periph_init(struct device_node *node, u32 fixed_div; u32 div_reg[3]; - of_property_read_u32(node, "reg", ®); + if (of_property_read_u32(node, "reg", ®)) + return; periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL); if (WARN_ON(!periph_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-periph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)