Skip to contentSkip to conversation

clk: mediatek: assign the initial value to clk_init_data of mtk_mux

PATCH Applied Weiyi Lu 2 participants 2 messages May 27, 2020 – May 29, 2020

Subsystems (3)
lore
Share & tools
lore

Weiyi Lu

author
#0 lore raw

PATCH v2 1/1 clk: mediatek: assign the initial value to clk_init_data of mtk_mux

When some new clock supports are introduced, e.g. [1] it might lead to an error although it should be NULL because clk_init_data is on the stack and it might have random values if using without initialization.
Add the missing initial value to clk_init_data.

[1] https://android-review.googlesource.com/c/kernel/common/+/1278046

Fixes a3ae549917f1 ("clk: mediatek: Add new clkmux register API")
---
 drivers/clk/mediatek/clk-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mediatek/clk-mux.c +1 -1
index 76f9cd0..14e127e 100644
@@ -160,7 +160,7 @@ struct clk *mtk_clk_register_mux(const struct mtk_mux *mux,
 				 spinlock_t *lock)
 {
 	struct mtk_clk_mux *clk_mux;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct clk *clk;
 
 	clk_mux = kzalloc(sizeof(*clk_mux), GFP_KERNEL);
Signature · 1 line
1.8.1.1.dirty
maintainer Applied
#1 lore raw

Quoting Weiyi Lu (2020-05-26 23:25:49)

Quoted 6 lines

When some new clock supports are introduced, e.g. [1] it might lead to an error although it should be NULL because clk_init_data is on the stack and it might have random values if using without initialization.
Add the missing initial value to clk_init_data.

Quoted 7 lines

[1] https://android-review.googlesource.com/c/kernel/common/+/1278046

Fixes a3ae549917f1 ("clk: mediatek: Add new clkmux register API")

---

Applied to clk-next