linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Matheus Castello <matheus@castello.eng.br>
Cc: tglx@linutronix.de, daniel.lezcano@linaro.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] clocksource: owl: Improve owl_timer_init fail messages
Date: Fri, 14 Feb 2020 15:46:05 +0100	[thread overview]
Message-ID: <e3d851477d569ccb66294b2292495778a3a24c09.camel@suse.de> (raw)
In-Reply-To: <20200214141714.GA30872@Mani-XPS-13-9360>

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

  reply	other threads:[~2020-02-14 14:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  6:49 [PATCH] clocksource: owl: Improve owl_timer_init fail messages Matheus Castello
2020-02-14 14:17 ` Manivannan Sadhasivam
2020-02-14 14:46   ` Andreas Färber [this message]
2020-02-19  0:48     ` [PATCH v2] " Matheus Castello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3d851477d569ccb66294b2292495778a3a24c09.camel@suse.de \
    --to=afaerber@suse.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=matheus@castello.eng.br \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).