summaryrefslogtreecommitdiff
path: root/drivers/clk/samsung/clk.c
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2014-02-06 22:33:11 +0400
committerTomasz Figa <t.figa@samsung.com>2014-05-14 21:23:25 +0400
commit91a1263fd2bab8704fa0a940c1ab6b813143ecc4 (patch)
tree34af239ad4929b71813aa7112db4f4b3efcd034d /drivers/clk/samsung/clk.c
parentd39e55e06371c1ba9d11f4a17a56a0f925d12415 (diff)
downloadlinux-91a1263fd2bab8704fa0a940c1ab6b813143ecc4.tar.xz
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 <t.figa@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/clk/samsung/clk.c')
-rw-r--r--drivers/clk/samsung/clk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index 41c1461d2f58..ce4d8a25dd61 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -54,14 +54,19 @@ struct samsung_clk_provider *__init samsung_clk_init(struct device_node *np,
struct samsung_clk_provider *ctx;
struct clk **clk_table;
int ret;
+ int i;
+
ctx = kzalloc(sizeof(struct samsung_clk_provider), GFP_KERNEL);
if (!ctx)
panic("could not allocate clock provider context.\n");
- clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL);
+ clk_table = kcalloc(nr_clks, sizeof(struct clk *), 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);
+
ctx->reg_base = base;
ctx->clk_data.clks = clk_table;
ctx->clk_data.clk_num = nr_clks;