Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1185016 > unrolled thread

[PATCH 1/4] clk: ti: Check kzalloc() for failures

Started byStephen Boyd <sboyd@codeaurora.org>
First post2015-07-15 22:10 +0200
Last post2015-07-15 22:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/4] clk: ti: Check kzalloc() for failures Stephen Boyd <sboyd@codeaurora.org> - 2015-07-15 22:10 +0200

#1185016 — [PATCH 1/4] clk: ti: Check kzalloc() for failures

FromStephen Boyd <sboyd@codeaurora.org>
Date2015-07-15 22:10 +0200
Subject[PATCH 1/4] clk: ti: Check kzalloc() for failures
Message-ID<pMBa9-1n9-1@gated-at.bofh.it>
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 <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web