[PATCH 02/02] clk: clk-of: Use alloc_bootmem() instead of kzalloc()

From: Chris Ball
Date: Thu Jun 21 2012 - 03:32:06 EST


When of_clk_add_provider() is used at boot time (during .init_early on
ARM, in the motivating case for this patch), kzalloc() cannot be used
because slab isn't up yet.

Signed-off-by: Chris Ball <cjb@xxxxxxxxxx>
---
drivers/clk/clk-of.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-of.c b/drivers/clk/clk-of.c
index 8b43416..adbb56b 100644
--- a/drivers/clk/clk-of.c
+++ b/drivers/clk/clk-of.c
@@ -22,6 +22,7 @@
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/of.h>
+#include <linux/bootmem.h>

#ifdef CONFIG_OF

@@ -67,7 +68,7 @@ int of_clk_add_provider(struct device_node *np,
{
struct of_clk_provider *cp;

- cp = kzalloc(sizeof(struct of_clk_provider), GFP_KERNEL);
+ cp = alloc_bootmem(sizeof(struct of_clk_provider));
if (!cp)
return -ENOMEM;

--
Chris Ball <cjb@xxxxxxxxxx> <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/