linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: samsung: Initialize clock table with error pointers
@ 2014-02-06 18:33 Tomasz Figa
  2014-02-06 22:21 ` Sylwester Nawrocki
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Figa @ 2014-02-06 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/clk/samsung/clk.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index 91bec3e..f3a71d0 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -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;
 
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] clk: samsung: Initialize clock table with error pointers
  2014-02-06 18:33 [PATCH] clk: samsung: Initialize clock table with error pointers Tomasz Figa
@ 2014-02-06 22:21 ` Sylwester Nawrocki
  0 siblings, 0 replies; 2+ messages in thread
From: Sylwester Nawrocki @ 2014-02-06 22:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/06/2014 07:33 PM, Tomasz Figa wrote:
> 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>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-06 22:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-06 18:33 [PATCH] clk: samsung: Initialize clock table with error pointers Tomasz Figa
2014-02-06 22:21 ` Sylwester Nawrocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).