clk: samsung: Initialize clock table with error pointers
Subsystems (3)
PATCH 1/1 clk: samsung: Initialize clock table with error pointers
Before this patch, the driver was simply zeroing the clock table, which is incorrect, because invalid clock numbers returned NULL instead of error pointers. This patch fixes this by changing the driver to initialize the array with PTR_ERR(-ENOENT).
Signed-off-by Tomasz Figa <[email protected]>
Acked-by Kyungmin Park <[email protected]>
--- drivers/clk/samsung/clk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/samsung/clk.c +6 -1
@@ -58,12 +58,17 @@ struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(void __init samsung_clk_init (struct device_node *np,void __iomem *base,unsigned long nr_clks) { +int i; + reg_base = base; - clk_table =kzalloc (sizeof (struct clk *) * nr_clks,GFP_KERNEL ); + clk_table =kmalloc (sizeof (struct clk *) * nr_clks,GFP_KERNEL );if (!clk_table)panic ("could not allocate clock lookup table\n" ); +for (i =0 ; i < nr_clks; ++i) + clk_table[i] =ERR_PTR (-ENOENT ); +if (!np)return ;
Signature · 1 line
1.8.5.2
PATCH 1/1 clk: samsung: Initialize clock table with error pointers
Quoted 7 lines · Tomasz Figa
Before this patch, the driver was simply zeroing the clock table, which is incorrect, because invalid clock numbers returned NULL instead of error pointers. This patch fixes this by changing the driver to initialize the array with
PTR_ERR(-ENOENT).Signed-off-by Tomasz Figa<[email protected]>Acked-by Kyungmin Park<[email protected]>
Reviewed-by Sylwester Nawrocki <[email protected]>