sh: use kzalloc() for cpg clocks

Convert the shared clock cpg code from bootmem to slab.
Without this patch the current bootmem code triggers
WARN_ON() because the slab is available.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
Magnus Damm 2009-06-17 04:55:42 +00:00 committed by Paul Mundt
parent 0ec39885b2
commit 4c7eb4ebc9

View file

@ -1,6 +1,6 @@
#include <linux/clk.h>
#include <linux/compiler.h>
#include <linux/bootmem.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <asm/clock.h>
@ -127,10 +127,11 @@ int __init sh_clk_div6_register(struct clk *clks, int nr)
int k;
freq_table_size *= (nr_divs + 1);
freq_table = alloc_bootmem(freq_table_size * nr);
if (!freq_table)
freq_table = kzalloc(freq_table_size * nr, GFP_KERNEL);
if (!freq_table) {
pr_err("sh_clk_div6_register: unable to alloc memory\n");
return -ENOMEM;
}
for (k = 0; !ret && (k < nr); k++) {
clkp = clks + k;
@ -175,10 +176,11 @@ int __init sh_clk_div4_register(struct clk *clks, int nr,
int k;
freq_table_size *= (nr_divs + 1);
freq_table = alloc_bootmem(freq_table_size * nr);
if (!freq_table)
freq_table = kzalloc(freq_table_size * nr, GFP_KERNEL);
if (!freq_table) {
pr_err("sh_clk_div4_register: unable to alloc memory\n");
return -ENOMEM;
}
for (k = 0; !ret && (k < nr); k++) {
clkp = clks + k;