smatch reports a failure to check kzalloc() here:

drivers/clk/ti/clk.c:232
omap2_clk_provider_init() error: potential null dereference 'io'.
(kzalloc returns null)

Check for an allocation failure and return -ENOMEM.

Cc: Tero Kristo <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
---
 drivers/clk/ti/clk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index 7e037c45e459..931b44118bdf 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -228,6 +228,8 @@ int __init omap2_clk_provider_init(struct device_node 
*parent, int index,
        clocks_node_ptr[index] = clocks;
 
        io = kzalloc(sizeof(*io), GFP_KERNEL);
+       if (!io)
+               return -ENOMEM;
 
        io->regmap = syscon;
        io->mem = mem;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to