diff mbox

clk: Zero-initialize memory for new clock in devm_clk_register

Message ID 1383043819-9123-1-git-send-email-tushar.behera@linaro.org
State New
Headers show

Commit Message

Tushar Behera Oct. 29, 2013, 10:50 a.m. UTC
Earlier to commit 64c862a839a8 ("devres: add kernel standard devm_k.alloc
functions") devres_alloc API used to zero-initialize the devres
allocated object, but now only the devres header is zero-initialized.

Since clk_register zero-initializes the memory while allocating for
a new clock, passing explicit flag __GFP_ZERO to devres_alloc in
devm_clk_register to match the behaviour.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/clk/clk.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tushar Behera Oct. 29, 2013, 11:45 a.m. UTC | #1
On 29 October 2013 16:20, Tushar Behera <tushar.behera@linaro.org> wrote:
> Earlier to commit 64c862a839a8 ("devres: add kernel standard devm_k.alloc
> functions") devres_alloc API used to zero-initialize the devres
> allocated object, but now only the devres header is zero-initialized.
>
> Since clk_register zero-initializes the memory while allocating for
> a new clock, passing explicit flag __GFP_ZERO to devres_alloc in
> devm_clk_register to match the behaviour.
>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---

Please ignore this patch. Kevin Hilman already has got a nicer patch
[1] that fixes this problem at a generic level.

[1] https://lkml.org/lkml/2013/10/19/5
diff mbox

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2cf2ea6..ea3f2b9 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1932,7 +1932,8 @@  struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw)
 	struct clk *clk;
 	int ret;
 
-	clk = devres_alloc(devm_clk_release, sizeof(*clk), GFP_KERNEL);
+	clk = devres_alloc(devm_clk_release, sizeof(*clk),
+			GFP_KERNEL|__GFP_ZERO);
 	if (!clk)
 		return ERR_PTR(-ENOMEM);