From: Stephen Boyd Date: Wed, 15 Jul 2015 18:55:42 +0000 (-0700) Subject: clk: ti: Check kzalloc() for failures X-Git-Tag: firefly_0821_release~176^2~908^2~109 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f645f72d876586c4950dcd5bf516744db0aeb30b;p=firefly-linux-kernel-4.4.55.git clk: ti: Check kzalloc() for failures 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. Acked-by: Tero Kristo Signed-off-by: Stephen Boyd --- diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index 3343bde47fe4..521e330e3046 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -227,6 +227,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;