linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] clk: mediatek: assign the initial value to clk_init_data of mtk_mux
@ 2020-05-27  6:25 Weiyi Lu
  2020-05-29  4:26 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Weiyi Lu @ 2020-05-27  6:25 UTC (permalink / raw)
  To: Nicolas Boichat, Stephen Boyd, Matthias Brugger
  Cc: James Liao, Fan Chen, linux-arm-kernel, linux-kernel,
	linux-mediatek, linux-clk, srv_heupstream, stable, Weiyi Lu,
	Owen Chen

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")
Cc: <stable@vger.kernel.org>
Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
---
 drivers/clk/mediatek/clk-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-mux.c b/drivers/clk/mediatek/clk-mux.c
index 76f9cd0..14e127e 100644
--- a/drivers/clk/mediatek/clk-mux.c
+++ b/drivers/clk/mediatek/clk-mux.c
@@ -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);
-- 
1.8.1.1.dirty

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

* Re: [PATCH v2] clk: mediatek: assign the initial value to clk_init_data of mtk_mux
  2020-05-27  6:25 [PATCH v2] clk: mediatek: assign the initial value to clk_init_data of mtk_mux Weiyi Lu
@ 2020-05-29  4:26 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2020-05-29  4:26 UTC (permalink / raw)
  To: Matthias Brugger, Nicolas Boichat, Weiyi Lu
  Cc: James Liao, Fan Chen, linux-arm-kernel, linux-kernel,
	linux-mediatek, linux-clk, srv_heupstream, stable, Weiyi Lu,
	Owen Chen

Quoting Weiyi Lu (2020-05-26 23:25:49)
> 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")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---

Applied to clk-next

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

end of thread, other threads:[~2020-05-29  4:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  6:25 [PATCH v2] clk: mediatek: assign the initial value to clk_init_data of mtk_mux Weiyi Lu
2020-05-29  4:26 ` Stephen Boyd

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).