All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: owl: Improve owl_timer_init fail messages
@ 2020-02-14  6:49 ` Matheus Castello
  0 siblings, 0 replies; 9+ messages in thread
From: Matheus Castello @ 2020-02-14  6:49 UTC (permalink / raw)
  To: afaerber, manivannan.sadhasivam
  Cc: daniel.lezcano, tglx, linux-arm-kernel, linux-kernel, Matheus Castello

Adding error messages, in case of not having a defined clock property
and in case of an error in clocksource_mmio_init, which may not be
fatal, so just adding a pr_err to notify that it failed.

Signed-off-by: Matheus Castello <matheus@castello.eng.br>
---

Tested on my Caninos Labrador s500 based board. If the clock property is not
set this message would help debug:

...
[    0.000000] Failed to get OF clock for clocksource
[    0.000000] Failed to initialize '/soc/timer@b0168000': -2
[    0.000000] timer_probe: no matching timers found
...

 drivers/clocksource/timer-owl.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
index 900fe736145d..f53596f9e86c 100644
--- a/drivers/clocksource/timer-owl.c
+++ b/drivers/clocksource/timer-owl.c
@@ -135,8 +135,10 @@ static int __init owl_timer_init(struct device_node *node)
 	}

 	clk = of_clk_get(node, 0);
-	if (IS_ERR(clk))
+	if (IS_ERR(clk)) {
+		pr_err("Failed to get OF clock for clocksource\n");
 		return PTR_ERR(clk);
+	}

 	rate = clk_get_rate(clk);

@@ -144,8 +146,11 @@ static int __init owl_timer_init(struct device_node *node)
 	owl_timer_set_enabled(owl_clksrc_base, true);

 	sched_clock_register(owl_timer_sched_read, 32, rate);
-	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
-			      rate, 200, 32, clocksource_mmio_readl_up);
+	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
+				    rate, 200, 32, clocksource_mmio_readl_up);
+
+	if (ret)
+		pr_err("Failed to register clocksource %d\n", ret);

 	owl_timer_reset(owl_clkevt_base);

--
2.25.0


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

* [PATCH] clocksource: owl: Improve owl_timer_init fail messages
@ 2020-02-14  6:49 ` Matheus Castello
  0 siblings, 0 replies; 9+ messages in thread
From: Matheus Castello @ 2020-02-14  6:49 UTC (permalink / raw)
  To: afaerber, manivannan.sadhasivam
  Cc: tglx, daniel.lezcano, linux-kernel, linux-arm-kernel, Matheus Castello

Adding error messages, in case of not having a defined clock property
and in case of an error in clocksource_mmio_init, which may not be
fatal, so just adding a pr_err to notify that it failed.

Signed-off-by: Matheus Castello <matheus@castello.eng.br>
---

Tested on my Caninos Labrador s500 based board. If the clock property is not
set this message would help debug:

...
[    0.000000] Failed to get OF clock for clocksource
[    0.000000] Failed to initialize '/soc/timer@b0168000': -2
[    0.000000] timer_probe: no matching timers found
...

 drivers/clocksource/timer-owl.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
index 900fe736145d..f53596f9e86c 100644
--- a/drivers/clocksource/timer-owl.c
+++ b/drivers/clocksource/timer-owl.c
@@ -135,8 +135,10 @@ static int __init owl_timer_init(struct device_node *node)
 	}

 	clk = of_clk_get(node, 0);
-	if (IS_ERR(clk))
+	if (IS_ERR(clk)) {
+		pr_err("Failed to get OF clock for clocksource\n");
 		return PTR_ERR(clk);
+	}

 	rate = clk_get_rate(clk);

@@ -144,8 +146,11 @@ static int __init owl_timer_init(struct device_node *node)
 	owl_timer_set_enabled(owl_clksrc_base, true);

 	sched_clock_register(owl_timer_sched_read, 32, rate);
-	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
-			      rate, 200, 32, clocksource_mmio_readl_up);
+	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
+				    rate, 200, 32, clocksource_mmio_readl_up);
+
+	if (ret)
+		pr_err("Failed to register clocksource %d\n", ret);

 	owl_timer_reset(owl_clkevt_base);

--
2.25.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clocksource: owl: Improve owl_timer_init fail messages
  2020-02-14  6:49 ` Matheus Castello
@ 2020-02-14 14:17   ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2020-02-14 14:17 UTC (permalink / raw)
  To: Matheus Castello
  Cc: afaerber, daniel.lezcano, tglx, linux-arm-kernel, linux-kernel

Hi,

Thanks for the patch!

On Fri, Feb 14, 2020 at 03:49:23AM -0300, Matheus Castello wrote:
> Adding error messages, in case of not having a defined clock property
> and in case of an error in clocksource_mmio_init, which may not be
> fatal, so just adding a pr_err to notify that it failed.
> 
> Signed-off-by: Matheus Castello <matheus@castello.eng.br>
> ---
> 
> Tested on my Caninos Labrador s500 based board. If the clock property is not
> set this message would help debug:
> 
> ...
> [    0.000000] Failed to get OF clock for clocksource
> [    0.000000] Failed to initialize '/soc/timer@b0168000': -2
> [    0.000000] timer_probe: no matching timers found
> ...
> 
>  drivers/clocksource/timer-owl.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
> index 900fe736145d..f53596f9e86c 100644
> --- a/drivers/clocksource/timer-owl.c
> +++ b/drivers/clocksource/timer-owl.c
> @@ -135,8 +135,10 @@ static int __init owl_timer_init(struct device_node *node)
>  	}
> 
>  	clk = of_clk_get(node, 0);
> -	if (IS_ERR(clk))
> +	if (IS_ERR(clk)) {
> +		pr_err("Failed to get OF clock for clocksource\n");

No need to mention OF here. Just, "Failed to get clock for clocksource"
is good enough.

>  		return PTR_ERR(clk);
> +	}
> 
>  	rate = clk_get_rate(clk);
> 
> @@ -144,8 +146,11 @@ static int __init owl_timer_init(struct device_node *node)
>  	owl_timer_set_enabled(owl_clksrc_base, true);
> 
>  	sched_clock_register(owl_timer_sched_read, 32, rate);
> -	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
> -			      rate, 200, 32, clocksource_mmio_readl_up);
> +	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
> +				    rate, 200, 32, clocksource_mmio_readl_up);
> +
> +	if (ret)
> +		pr_err("Failed to register clocksource %d\n", ret);
> 

Do you want to continue if it fails? I'd bail out.

Thanks,
Mani

>  	owl_timer_reset(owl_clkevt_base);
> 
> --
> 2.25.0
> 

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

* Re: [PATCH] clocksource: owl: Improve owl_timer_init fail messages
@ 2020-02-14 14:17   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2020-02-14 14:17 UTC (permalink / raw)
  To: Matheus Castello
  Cc: tglx, daniel.lezcano, afaerber, linux-arm-kernel, linux-kernel

Hi,

Thanks for the patch!

On Fri, Feb 14, 2020 at 03:49:23AM -0300, Matheus Castello wrote:
> Adding error messages, in case of not having a defined clock property
> and in case of an error in clocksource_mmio_init, which may not be
> fatal, so just adding a pr_err to notify that it failed.
> 
> Signed-off-by: Matheus Castello <matheus@castello.eng.br>
> ---
> 
> Tested on my Caninos Labrador s500 based board. If the clock property is not
> set this message would help debug:
> 
> ...
> [    0.000000] Failed to get OF clock for clocksource
> [    0.000000] Failed to initialize '/soc/timer@b0168000': -2
> [    0.000000] timer_probe: no matching timers found
> ...
> 
>  drivers/clocksource/timer-owl.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
> index 900fe736145d..f53596f9e86c 100644
> --- a/drivers/clocksource/timer-owl.c
> +++ b/drivers/clocksource/timer-owl.c
> @@ -135,8 +135,10 @@ static int __init owl_timer_init(struct device_node *node)
>  	}
> 
>  	clk = of_clk_get(node, 0);
> -	if (IS_ERR(clk))
> +	if (IS_ERR(clk)) {
> +		pr_err("Failed to get OF clock for clocksource\n");

No need to mention OF here. Just, "Failed to get clock for clocksource"
is good enough.

>  		return PTR_ERR(clk);
> +	}
> 
>  	rate = clk_get_rate(clk);
> 
> @@ -144,8 +146,11 @@ static int __init owl_timer_init(struct device_node *node)
>  	owl_timer_set_enabled(owl_clksrc_base, true);
> 
>  	sched_clock_register(owl_timer_sched_read, 32, rate);
> -	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
> -			      rate, 200, 32, clocksource_mmio_readl_up);
> +	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
> +				    rate, 200, 32, clocksource_mmio_readl_up);
> +
> +	if (ret)
> +		pr_err("Failed to register clocksource %d\n", ret);
> 

Do you want to continue if it fails? I'd bail out.

Thanks,
Mani

>  	owl_timer_reset(owl_clkevt_base);
> 
> --
> 2.25.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clocksource: owl: Improve owl_timer_init fail messages
  2020-02-14 14:17   ` Manivannan Sadhasivam
@ 2020-02-14 14:46     ` Andreas Färber
  -1 siblings, 0 replies; 9+ messages in thread
From: Andreas Färber @ 2020-02-14 14:46 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Matheus Castello
  Cc: daniel.lezcano, tglx, linux-arm-kernel, linux-kernel

Hi,

Am Freitag, den 14.02.2020, 19:47 +0530 schrieb Manivannan Sadhasivam:
> On Fri, Feb 14, 2020 at 03:49:23AM -0300, Matheus Castello wrote:
> > Adding error messages, in case of not having a defined clock
> > property
> > and in case of an error in clocksource_mmio_init, which may not be
> > fatal, so just adding a pr_err to notify that it failed.
> > 
> > Signed-off-by: Matheus Castello <matheus@castello.eng.br>
> > ---
> > 
> > Tested on my Caninos Labrador s500 based board. If the clock
> > property is not
> > set this message would help debug:
> > 
> > ...
> > [    0.000000] Failed to get OF clock for clocksource
> > [    0.000000] Failed to initialize '/soc/timer@b0168000': -2
> > [    0.000000] timer_probe: no matching timers found
> > ...
> > 
> >  drivers/clocksource/timer-owl.c | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/clocksource/timer-owl.c
> > b/drivers/clocksource/timer-owl.c
> > index 900fe736145d..f53596f9e86c 100644
> > --- a/drivers/clocksource/timer-owl.c
> > +++ b/drivers/clocksource/timer-owl.c
> > @@ -135,8 +135,10 @@ static int __init owl_timer_init(struct
> > device_node *node)
> >  	}
> > 
> >  	clk = of_clk_get(node, 0);
> > -	if (IS_ERR(clk))
> > +	if (IS_ERR(clk)) {
> > +		pr_err("Failed to get OF clock for clocksource\n");
> 
> No need to mention OF here. Just, "Failed to get clock for
> clocksource"
> is good enough.

We should be consistent then and output PTR_ERR(clk), too.

i.e., "Failed to get clock for clocksource (%d)\n"

> 
> >  		return PTR_ERR(clk);
> > +	}
> > 
> >  	rate = clk_get_rate(clk);
> > 
> > @@ -144,8 +146,11 @@ static int __init owl_timer_init(struct
> > device_node *node)
> >  	owl_timer_set_enabled(owl_clksrc_base, true);
> > 
> >  	sched_clock_register(owl_timer_sched_read, 32, rate);
> > -	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
> > -			      rate, 200, 32,
> > clocksource_mmio_readl_up);
> > +	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node-
> > >name,
> > +				    rate, 200, 32,
> > clocksource_mmio_readl_up);
> > +
> > +	if (ret)
> > +		pr_err("Failed to register clocksource %d\n", ret);

It's not a numeric clocksource, so for humans please use "... (%d)\n".

> > 
> 
> Do you want to continue if it fails? I'd bail out.

Agreed, but I'd suggest to check under which circumstances this can
actually fail and how other drivers handle it, given that it was not
checked before. Was this missed during original review, or is the
return value new?

Cheers,
Andreas

-- 
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)


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

* Re: [PATCH] clocksource: owl: Improve owl_timer_init fail messages
@ 2020-02-14 14:46     ` Andreas Färber
  0 siblings, 0 replies; 9+ messages in thread
From: Andreas Färber @ 2020-02-14 14:46 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Matheus Castello
  Cc: tglx, daniel.lezcano, linux-kernel, linux-arm-kernel

Hi,

Am Freitag, den 14.02.2020, 19:47 +0530 schrieb Manivannan Sadhasivam:
> On Fri, Feb 14, 2020 at 03:49:23AM -0300, Matheus Castello wrote:
> > Adding error messages, in case of not having a defined clock
> > property
> > and in case of an error in clocksource_mmio_init, which may not be
> > fatal, so just adding a pr_err to notify that it failed.
> > 
> > Signed-off-by: Matheus Castello <matheus@castello.eng.br>
> > ---
> > 
> > Tested on my Caninos Labrador s500 based board. If the clock
> > property is not
> > set this message would help debug:
> > 
> > ...
> > [    0.000000] Failed to get OF clock for clocksource
> > [    0.000000] Failed to initialize '/soc/timer@b0168000': -2
> > [    0.000000] timer_probe: no matching timers found
> > ...
> > 
> >  drivers/clocksource/timer-owl.c | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/clocksource/timer-owl.c
> > b/drivers/clocksource/timer-owl.c
> > index 900fe736145d..f53596f9e86c 100644
> > --- a/drivers/clocksource/timer-owl.c
> > +++ b/drivers/clocksource/timer-owl.c
> > @@ -135,8 +135,10 @@ static int __init owl_timer_init(struct
> > device_node *node)
> >  	}
> > 
> >  	clk = of_clk_get(node, 0);
> > -	if (IS_ERR(clk))
> > +	if (IS_ERR(clk)) {
> > +		pr_err("Failed to get OF clock for clocksource\n");
> 
> No need to mention OF here. Just, "Failed to get clock for
> clocksource"
> is good enough.

We should be consistent then and output PTR_ERR(clk), too.

i.e., "Failed to get clock for clocksource (%d)\n"

> 
> >  		return PTR_ERR(clk);
> > +	}
> > 
> >  	rate = clk_get_rate(clk);
> > 
> > @@ -144,8 +146,11 @@ static int __init owl_timer_init(struct
> > device_node *node)
> >  	owl_timer_set_enabled(owl_clksrc_base, true);
> > 
> >  	sched_clock_register(owl_timer_sched_read, 32, rate);
> > -	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
> > -			      rate, 200, 32,
> > clocksource_mmio_readl_up);
> > +	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node-
> > >name,
> > +				    rate, 200, 32,
> > clocksource_mmio_readl_up);
> > +
> > +	if (ret)
> > +		pr_err("Failed to register clocksource %d\n", ret);

It's not a numeric clocksource, so for humans please use "... (%d)\n".

> > 
> 
> Do you want to continue if it fails? I'd bail out.

Agreed, but I'd suggest to check under which circumstances this can
actually fail and how other drivers handle it, given that it was not
checked before. Was this missed during original review, or is the
return value new?

Cheers,
Andreas

-- 
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2] clocksource: owl: Improve owl_timer_init fail messages
  2020-02-14 14:46     ` Andreas Färber
@ 2020-02-19  0:48       ` Matheus Castello
  -1 siblings, 0 replies; 9+ messages in thread
From: Matheus Castello @ 2020-02-19  0:48 UTC (permalink / raw)
  To: afaerber, manivannan.sadhasivam
  Cc: daniel.lezcano, tglx, linux-arm-kernel, linux-kernel, Matheus Castello

Check the return from clocksource_mmio_init, add messages in case of
an error and in case of not having a defined clock property.

Signed-off-by: Matheus Castello <matheus@castello.eng.br>
---

Thanks Manivannan and Andreas for the review.
Tested on my Caninos Labrador s500 based board.

Changes since v1:
(suggested by maintainers)
- Maintains consistency output PTR_ERR(clk)
- Returning in case of error on clocksource_mmio_init
- Use parentheses between the error code
- Remove OF mention

 drivers/clocksource/timer-owl.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
index 900fe736145d..820fbcc05503 100644
--- a/drivers/clocksource/timer-owl.c
+++ b/drivers/clocksource/timer-owl.c
@@ -135,8 +135,11 @@ static int __init owl_timer_init(struct device_node *node)
 	}

 	clk = of_clk_get(node, 0);
-	if (IS_ERR(clk))
-		return PTR_ERR(clk);
+	if (IS_ERR(clk)) {
+		ret = PTR_ERR(clk);
+		pr_err("Failed to get clock for clocksource (%d)\n", ret);
+		return ret;
+	}

 	rate = clk_get_rate(clk);

@@ -144,8 +147,12 @@ static int __init owl_timer_init(struct device_node *node)
 	owl_timer_set_enabled(owl_clksrc_base, true);

 	sched_clock_register(owl_timer_sched_read, 32, rate);
-	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
-			      rate, 200, 32, clocksource_mmio_readl_up);
+	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
+				    rate, 200, 32, clocksource_mmio_readl_up);
+	if (ret) {
+		pr_err("Failed to register clocksource (%d)\n", ret);
+		return ret;
+	}

 	owl_timer_reset(owl_clkevt_base);

--
2.25.0


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

* [PATCH v2] clocksource: owl: Improve owl_timer_init fail messages
@ 2020-02-19  0:48       ` Matheus Castello
  0 siblings, 0 replies; 9+ messages in thread
From: Matheus Castello @ 2020-02-19  0:48 UTC (permalink / raw)
  To: afaerber, manivannan.sadhasivam
  Cc: tglx, daniel.lezcano, linux-kernel, linux-arm-kernel, Matheus Castello

Check the return from clocksource_mmio_init, add messages in case of
an error and in case of not having a defined clock property.

Signed-off-by: Matheus Castello <matheus@castello.eng.br>
---

Thanks Manivannan and Andreas for the review.
Tested on my Caninos Labrador s500 based board.

Changes since v1:
(suggested by maintainers)
- Maintains consistency output PTR_ERR(clk)
- Returning in case of error on clocksource_mmio_init
- Use parentheses between the error code
- Remove OF mention

 drivers/clocksource/timer-owl.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
index 900fe736145d..820fbcc05503 100644
--- a/drivers/clocksource/timer-owl.c
+++ b/drivers/clocksource/timer-owl.c
@@ -135,8 +135,11 @@ static int __init owl_timer_init(struct device_node *node)
 	}

 	clk = of_clk_get(node, 0);
-	if (IS_ERR(clk))
-		return PTR_ERR(clk);
+	if (IS_ERR(clk)) {
+		ret = PTR_ERR(clk);
+		pr_err("Failed to get clock for clocksource (%d)\n", ret);
+		return ret;
+	}

 	rate = clk_get_rate(clk);

@@ -144,8 +147,12 @@ static int __init owl_timer_init(struct device_node *node)
 	owl_timer_set_enabled(owl_clksrc_base, true);

 	sched_clock_register(owl_timer_sched_read, 32, rate);
-	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
-			      rate, 200, 32, clocksource_mmio_readl_up);
+	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
+				    rate, 200, 32, clocksource_mmio_readl_up);
+	if (ret) {
+		pr_err("Failed to register clocksource (%d)\n", ret);
+		return ret;
+	}

 	owl_timer_reset(owl_clkevt_base);

--
2.25.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [tip: timers/core] clocksource/drivers/owl: Improve owl_timer_init fail messages
  2020-02-19  0:48       ` Matheus Castello
  (?)
@ 2020-03-19  8:47       ` tip-bot2 for Matheus Castello
  -1 siblings, 0 replies; 9+ messages in thread
From: tip-bot2 for Matheus Castello @ 2020-03-19  8:47 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Matheus Castello, Daniel Lezcano, x86, LKML

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     ad1ded9d2e3d1eb452ff58d325aadf237e187bd9
Gitweb:        https://git.kernel.org/tip/ad1ded9d2e3d1eb452ff58d325aadf237e187bd9
Author:        Matheus Castello <matheus@castello.eng.br>
AuthorDate:    Tue, 18 Feb 2020 21:48:10 -03:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 27 Feb 2020 09:42:00 +01:00

clocksource/drivers/owl: Improve owl_timer_init fail messages

Check the return from clocksource_mmio_init, add messages in case of
an error and in case of not having a defined clock property.

Signed-off-by: Matheus Castello <matheus@castello.eng.br>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200219004810.411190-1-matheus@castello.eng.br
---
 drivers/clocksource/timer-owl.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
index 900fe73..ac97420 100644
--- a/drivers/clocksource/timer-owl.c
+++ b/drivers/clocksource/timer-owl.c
@@ -135,8 +135,11 @@ static int __init owl_timer_init(struct device_node *node)
 	}
 
 	clk = of_clk_get(node, 0);
-	if (IS_ERR(clk))
-		return PTR_ERR(clk);
+	if (IS_ERR(clk)) {
+		ret = PTR_ERR(clk);
+		pr_err("Failed to get clock for clocksource (%d)\n", ret);
+		return ret;
+	}
 
 	rate = clk_get_rate(clk);
 
@@ -144,8 +147,12 @@ static int __init owl_timer_init(struct device_node *node)
 	owl_timer_set_enabled(owl_clksrc_base, true);
 
 	sched_clock_register(owl_timer_sched_read, 32, rate);
-	clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
-			      rate, 200, 32, clocksource_mmio_readl_up);
+	ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
+				    rate, 200, 32, clocksource_mmio_readl_up);
+	if (ret) {
+		pr_err("Failed to register clocksource (%d)\n", ret);
+		return ret;
+	}
 
 	owl_timer_reset(owl_clkevt_base);
 

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

end of thread, other threads:[~2020-03-19  8:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14  6:49 [PATCH] clocksource: owl: Improve owl_timer_init fail messages Matheus Castello
2020-02-14  6:49 ` Matheus Castello
2020-02-14 14:17 ` Manivannan Sadhasivam
2020-02-14 14:17   ` Manivannan Sadhasivam
2020-02-14 14:46   ` Andreas Färber
2020-02-14 14:46     ` Andreas Färber
2020-02-19  0:48     ` [PATCH v2] " Matheus Castello
2020-02-19  0:48       ` Matheus Castello
2020-03-19  8:47       ` [tip: timers/core] clocksource/drivers/owl: " tip-bot2 for Matheus Castello

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.