linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Followup to "Make clk_hw::init NULL after clk registration"
@ 2019-08-15 16:00 Stephen Boyd
  2019-08-15 16:00 ` [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration Stephen Boyd
  2019-08-19  7:02 ` [PATCH 0/4] Followup to "Make clk_hw::init NULL after clk registration" Guillaume Tucker
  0 siblings, 2 replies; 7+ messages in thread
From: Stephen Boyd @ 2019-08-15 16:00 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-kernel, linux-clk, linux-rtc, bot, tomeu.vizoso,
	guillaume.tucker, mgalka, broonie, matthew.hart, khilman,
	enric.balletbo, Sylwester Nawrocki, Alessandro Zummo,
	Alexandre Belloni, Chen-Yu Tsai, Jun Nie, Maxime Ripard,
	Shawn Guo, Sugaya Taichi, Taniya Das

I found some more cases where the init structure is referenced from
within the clk_hw struct after clk_registration is called. I suspect the
rtc driver fix is useful to avoid crashes on Allwinner devices, reported
by kernel-ci.

Cc: <bot@kernelci.org>                                                                                                                                      
Cc: <tomeu.vizoso@collabora.com>
Cc: <guillaume.tucker@collabora.com>
Cc: <mgalka@collabora.com>
Cc: <broonie@kernel.org>
Cc: <matthew.hart@linaro.org>
Cc: <khilman@baylibre.com>
Cc: <enric.balletbo@collabora.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>      
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Jun Nie <jun.nie@linaro.org>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sugaya Taichi <sugaya.taichi@socionext.com>
Cc: Taniya Das <tdas@codeaurora.org>

Stephen Boyd (4):
  clk: milbeaut:  Don't reference clk_init_data after registration
  clk: zx296718: Don't reference clk_init_data after registration
  rtc: sun6i: Don't reference clk_init_data after registration
  clk: qcom: Remove error prints from DFS registration

 drivers/clk/clk-milbeaut.c     |   2 +-
 drivers/clk/qcom/clk-rcg2.c    |   8 +--
 drivers/clk/zte/clk-zx296718.c | 109 +++++++++++++++------------------
 drivers/rtc/rtc-sun6i.c        |   2 +-
 4 files changed, 52 insertions(+), 69 deletions(-)

-- 
Sent by a computer through tubes


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

* [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration
  2019-08-15 16:00 [PATCH 0/4] Followup to "Make clk_hw::init NULL after clk registration" Stephen Boyd
@ 2019-08-15 16:00 ` Stephen Boyd
  2019-08-15 16:11   ` Chen-Yu Tsai
                     ` (3 more replies)
  2019-08-19  7:02 ` [PATCH 0/4] Followup to "Make clk_hw::init NULL after clk registration" Guillaume Tucker
  1 sibling, 4 replies; 7+ messages in thread
From: Stephen Boyd @ 2019-08-15 16:00 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-kernel, linux-clk, linux-rtc, Alessandro Zummo,
	Alexandre Belloni, Maxime Ripard, Chen-Yu Tsai

A future patch is going to change semantics of clk_register() so that
clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
referencing this member here so that we don't run into NULL pointer
exceptions.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---

Please ack so I can take this through clk tree.

 drivers/rtc/rtc-sun6i.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index c0e75c373605..d50ee023b559 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -279,7 +279,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node,
 
 	of_property_read_string_index(node, "clock-output-names", 1,
 				      &clkout_name);
-	rtc->ext_losc = clk_register_gate(NULL, clkout_name, rtc->hw.init->name,
+	rtc->ext_losc = clk_register_gate(NULL, clkout_name, init.name,
 					  0, rtc->base + SUN6I_LOSC_OUT_GATING,
 					  SUN6I_LOSC_OUT_GATING_EN_OFFSET, 0,
 					  &rtc->lock);
-- 
Sent by a computer through tubes


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

* Re: [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration
  2019-08-15 16:00 ` [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration Stephen Boyd
@ 2019-08-15 16:11   ` Chen-Yu Tsai
  2019-08-15 21:59   ` Stephen Boyd
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Chen-Yu Tsai @ 2019-08-15 16:11 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, linux-kernel, linux-clk, linux-rtc,
	Alessandro Zummo, Alexandre Belloni, Maxime Ripard

On Fri, Aug 16, 2019 at 12:00 AM Stephen Boyd <sboyd@kernel.org> wrote:
>
> A future patch is going to change semantics of clk_register() so that
> clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
> referencing this member here so that we don't run into NULL pointer
> exceptions.
>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>

Acked-by: Chen-Yu Tsai <wens@csie.org>

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

* Re: [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration
  2019-08-15 16:00 ` [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration Stephen Boyd
  2019-08-15 16:11   ` Chen-Yu Tsai
@ 2019-08-15 21:59   ` Stephen Boyd
  2019-08-16 14:50   ` Alexandre Belloni
  2019-08-16 17:20   ` Stephen Boyd
  3 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2019-08-15 21:59 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-kernel, linux-clk, linux-rtc, Alessandro Zummo,
	Alexandre Belloni, Maxime Ripard, Chen-Yu Tsai

Quoting Stephen Boyd (2019-08-15 09:00:19)
> A future patch is going to change semantics of clk_register() so that
> clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
> referencing this member here so that we don't run into NULL pointer
> exceptions.
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
> 

Looks like this fixed the sunxi boot crashes in -next. I'll add a tag
for kernelci credit.


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

* Re: [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration
  2019-08-15 16:00 ` [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration Stephen Boyd
  2019-08-15 16:11   ` Chen-Yu Tsai
  2019-08-15 21:59   ` Stephen Boyd
@ 2019-08-16 14:50   ` Alexandre Belloni
  2019-08-16 17:20   ` Stephen Boyd
  3 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2019-08-16 14:50 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, linux-kernel, linux-clk, linux-rtc,
	Alessandro Zummo, Maxime Ripard, Chen-Yu Tsai

On 15/08/2019 09:00:19-0700, Stephen Boyd wrote:
> A future patch is going to change semantics of clk_register() so that
> clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
> referencing this member here so that we don't run into NULL pointer
> exceptions.
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
> 
> Please ack so I can take this through clk tree.
> 
>  drivers/rtc/rtc-sun6i.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
> index c0e75c373605..d50ee023b559 100644
> --- a/drivers/rtc/rtc-sun6i.c
> +++ b/drivers/rtc/rtc-sun6i.c
> @@ -279,7 +279,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node,
>  
>  	of_property_read_string_index(node, "clock-output-names", 1,
>  				      &clkout_name);
> -	rtc->ext_losc = clk_register_gate(NULL, clkout_name, rtc->hw.init->name,
> +	rtc->ext_losc = clk_register_gate(NULL, clkout_name, init.name,
>  					  0, rtc->base + SUN6I_LOSC_OUT_GATING,
>  					  SUN6I_LOSC_OUT_GATING_EN_OFFSET, 0,
>  					  &rtc->lock);
> -- 
> Sent by a computer through tubes
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration
  2019-08-15 16:00 ` [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration Stephen Boyd
                     ` (2 preceding siblings ...)
  2019-08-16 14:50   ` Alexandre Belloni
@ 2019-08-16 17:20   ` Stephen Boyd
  3 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2019-08-16 17:20 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-kernel, linux-clk, linux-rtc, Alessandro Zummo,
	Alexandre Belloni, Maxime Ripard, Chen-Yu Tsai

Quoting Stephen Boyd (2019-08-15 09:00:19)
> A future patch is going to change semantics of clk_register() so that
> clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
> referencing this member here so that we don't run into NULL pointer
> exceptions.
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---

Applied to clk-next


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

* Re: [PATCH 0/4] Followup to "Make clk_hw::init NULL after clk registration"
  2019-08-15 16:00 [PATCH 0/4] Followup to "Make clk_hw::init NULL after clk registration" Stephen Boyd
  2019-08-15 16:00 ` [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration Stephen Boyd
@ 2019-08-19  7:02 ` Guillaume Tucker
  1 sibling, 0 replies; 7+ messages in thread
From: Guillaume Tucker @ 2019-08-19  7:02 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-kernel, linux-clk, linux-rtc, bot, tomeu.vizoso, mgalka,
	broonie, matthew.hart, khilman, enric.balletbo,
	Sylwester Nawrocki, Alessandro Zummo, Alexandre Belloni,
	Chen-Yu Tsai, Jun Nie, Maxime Ripard, Shawn Guo, Sugaya Taichi,
	Taniya Das

On 15/08/2019 17:00, Stephen Boyd wrote:
> I found some more cases where the init structure is referenced from
> within the clk_hw struct after clk_registration is called. I suspect the
> rtc driver fix is useful to avoid crashes on Allwinner devices, reported
> by kernel-ci.

Please feel free to add this trailer where appropriate:

  Reported-by: "kernelci.org bot" <bot@kernelci.org>


Thanks,
Guillaume

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

end of thread, other threads:[~2019-08-19  7:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15 16:00 [PATCH 0/4] Followup to "Make clk_hw::init NULL after clk registration" Stephen Boyd
2019-08-15 16:00 ` [PATCH 3/4] rtc: sun6i: Don't reference clk_init_data after registration Stephen Boyd
2019-08-15 16:11   ` Chen-Yu Tsai
2019-08-15 21:59   ` Stephen Boyd
2019-08-16 14:50   ` Alexandre Belloni
2019-08-16 17:20   ` Stephen Boyd
2019-08-19  7:02 ` [PATCH 0/4] Followup to "Make clk_hw::init NULL after clk registration" Guillaume Tucker

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