diff mbox series

[U-Boot] clk: initialize clk->data when using default xlate

Message ID 20190711090024.24019-1-nsekhar@ti.com
State Accepted
Commit e497fabb9186bb2f36b4f3ceda4c69bea8e22233
Delegated to: Simon Glass
Headers show
Series [U-Boot] clk: initialize clk->data when using default xlate | expand

Commit Message

Sekhar Nori July 11, 2019, 9 a.m. UTC
Right now when using clk_of_xlate_default(), clk->data
remains un-initialized because clk_get_bulk() does not
initialize memory on allocation of clock structure.

This can cause problems when data is used to match if
two clocks pointers are exactly the same underlying
clocks, for example.

Fix it by initializing clk->data to 0.

Suggested-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 drivers/clk/clk-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Simon Glass July 21, 2019, 1:50 a.m. UTC | #1
Right now when using clk_of_xlate_default(), clk->data
remains un-initialized because clk_get_bulk() does not
initialize memory on allocation of clock structure.

This can cause problems when data is used to match if
two clocks pointers are exactly the same underlying
clocks, for example.

Fix it by initializing clk->data to 0.

Suggested-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 drivers/clk/clk-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 823be2bcb624..4a6fcd098a94 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -51,6 +51,8 @@  static int clk_of_xlate_default(struct clk *clk,
 	else
 		clk->id = 0;
 
+	clk->data = 0;
+
 	return 0;
 }