Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1441489 > unrolled thread

Re: [PATCH 44/93] clocksource/drivers/time-armada-370-xp: Convert init function to return error

Started byAnna-Maria Gleixner <anna-maria@linutronix.de>
First post2016-07-12 17:20 +0200
Last post2016-07-12 17:50 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 44/93] clocksource/drivers/time-armada-370-xp: Convert  init function to return error Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-12 17:20 +0200
    Re: [PATCH 44/93] clocksource/drivers/time-armada-370-xp: Convert  init function to return error Thomas Gleixner <tglx@linutronix.de> - 2016-07-12 17:30 +0200
    Re: [PATCH 44/93] clocksource/drivers/time-armada-370-xp: Convert  init function to return error Anna-Maria Gleixner <anna-maria@linutronix.de> - 2016-07-12 17:40 +0200
      [tip:timers/core] clocksource/drivers/time-armada-370-xp: Fix  return value check tip-bot for Anna-Maria Gleixner <tipbot@zytor.com> - 2016-07-12 17:50 +0200

#1441489 — Re: [PATCH 44/93] clocksource/drivers/time-armada-370-xp: Convert init function to return error

FromAnna-Maria Gleixner <anna-maria@linutronix.de>
Date2016-07-12 17:20 +0200
SubjectRe: [PATCH 44/93] clocksource/drivers/time-armada-370-xp: Convert init function to return error
Message-ID<rU7Dz-6Gj-7@gated-at.bofh.it>
On Thu, 7 Jul 2016, Daniel Lezcano wrote:

> The init functions do not return any error. They behave as the following:
> 
>   - panic, thus leading to a kernel crash while another timer may work and
>        make the system boot up correctly
> 
>   or
> 
>   - print an error and let the caller unaware if the state of the system
> 
> Change that by converting the init functions to return an error conforming
> to the CLOCKSOURCE_OF_RET prototype.
> 
> Proper error handling (rollback, errno value) will be changed later case
> by case, thus this change just return back an error or success in the init
> function.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/clocksource/time-armada-370-xp.c | 102 +++++++++++++++++++++++--------
>  1 file changed, 76 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
> index 601dbf74..bc4ab48 100644
> --- a/drivers/clocksource/time-armada-370-xp.c
> +++ b/drivers/clocksource/time-armada-370-xp.c
> @@ -323,33 +336,54 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
>  				"armada_370_xp_per_cpu_tick",
>  				armada_370_xp_evt);
>  	/* Immediately configure the timer on the boot CPU */
> -	if (!res)
> -		armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
> +	if (res) {
> +		pr_err("Failed to request percpu irq");
> +		return res;
> +	}
> +
> +	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
> +	if (!res) {

I think the "!" is a mistake, because armada_370_xp_timer_setup()
returns zero. See delta patch fixing this below.

> +		pr_err("Failed to setup timer");
> +		return res;
> +	}


8<-------------------
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -342,7 +342,7 @@ static int __init armada_370_xp_timer_co
 	}
 
 	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
-	if (!res) {
+	if (res) {
 		pr_err("Failed to setup timer");
 		return res;
 	}

[toc] | [next] | [standalone]


#1441507

FromThomas Gleixner <tglx@linutronix.de>
Date2016-07-12 17:30 +0200
Message-ID<rU7Ng-6JY-13@gated-at.bofh.it>
In reply to#1441489
On Tue, 12 Jul 2016, Anna-Maria Gleixner wrote:
> On Thu, 7 Jul 2016, Daniel Lezcano wrote:
> > +	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
> > +	if (!res) {
> 
> I think the "!" is a mistake, because armada_370_xp_timer_setup()
> returns zero. See delta patch fixing this below.

Yes it is wrong.

Care to send a proper patch with a proper changelog?
 
Thanks,

	tglx

> 8<-------------------
> --- a/drivers/clocksource/time-armada-370-xp.c
> +++ b/drivers/clocksource/time-armada-370-xp.c
> @@ -342,7 +342,7 @@ static int __init armada_370_xp_timer_co
>  	}
>  
>  	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
> -	if (!res) {
> +	if (res) {
>  		pr_err("Failed to setup timer");
>  		return res;
>  	}
> 

[toc] | [prev] | [next] | [standalone]


#1441511

FromAnna-Maria Gleixner <anna-maria@linutronix.de>
Date2016-07-12 17:40 +0200
Message-ID<rU7WV-6Ps-13@gated-at.bofh.it>
In reply to#1441489
On Tue, 12 Jul 2016, Anna-Maria Gleixner wrote:

> On Thu, 7 Jul 2016, Daniel Lezcano wrote:
> 
> > The init functions do not return any error. They behave as the following:
> > 
> >   - panic, thus leading to a kernel crash while another timer may work and
> >        make the system boot up correctly
> > 
> >   or
> > 
> >   - print an error and let the caller unaware if the state of the system
> > 
> > Change that by converting the init functions to return an error conforming
> > to the CLOCKSOURCE_OF_RET prototype.
> > 
> > Proper error handling (rollback, errno value) will be changed later case
> > by case, thus this change just return back an error or success in the init
> > function.
> > 
> > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> > ---
> >  drivers/clocksource/time-armada-370-xp.c | 102 +++++++++++++++++++++++--------
> >  1 file changed, 76 insertions(+), 26 deletions(-)
> > 
> > diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
> > index 601dbf74..bc4ab48 100644
> > --- a/drivers/clocksource/time-armada-370-xp.c
> > +++ b/drivers/clocksource/time-armada-370-xp.c
> > @@ -323,33 +336,54 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
> >  				"armada_370_xp_per_cpu_tick",
> >  				armada_370_xp_evt);
> >  	/* Immediately configure the timer on the boot CPU */
> > -	if (!res)
> > -		armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
> > +	if (res) {
> > +		pr_err("Failed to request percpu irq");
> > +		return res;
> > +	}
> > +
> > +	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
> > +	if (!res) {
> 
> I think the "!" is a mistake, because armada_370_xp_timer_setup()
> returns zero. See delta patch fixing this below.
> 
> > +		pr_err("Failed to setup timer");
> > +		return res;
> > +	}
> 

I'm sorry, I missed to include the patch with a commit message.

8<-------------
Subject: clocksource/drivers/time-armada-370-xp: Fix return value check
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Tue, 12 Jul 2016 16:40:09 +0200

The failure check of armada_370_xp_timer_setup() in
armada_370_xp_timer_common_init() is negated. This leads to an
error message and exit in case of a successful initialization.
Remove the stray '!'.

Fixes: 12549e27c63c ("clocksource/drivers/time-armada-370-xp: Convert init function to return error")
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
 drivers/clocksource/time-armada-370-xp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -342,7 +342,7 @@ static int __init armada_370_xp_timer_co
 	}
 
 	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
-	if (!res) {
+	if (res) {
 		pr_err("Failed to setup timer");
 		return res;
 	}

[toc] | [prev] | [next] | [standalone]


#1441521 — [tip:timers/core] clocksource/drivers/time-armada-370-xp: Fix return value check

Fromtip-bot for Anna-Maria Gleixner <tipbot@zytor.com>
Date2016-07-12 17:50 +0200
Subject[tip:timers/core] clocksource/drivers/time-armada-370-xp: Fix return value check
Message-ID<rU86C-6SS-9@gated-at.bofh.it>
In reply to#1441511
Commit-ID:  1d661bf5327a2c059ec967f850e89362e637f4e6
Gitweb:     http://git.kernel.org/tip/1d661bf5327a2c059ec967f850e89362e637f4e6
Author:     Anna-Maria Gleixner <anna-maria@linutronix.de>
AuthorDate: Tue, 12 Jul 2016 16:40:09 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 12 Jul 2016 17:33:22 +0200

clocksource/drivers/time-armada-370-xp: Fix return value check

The failure check of armada_370_xp_timer_setup() in
armada_370_xp_timer_common_init() is negated. This leads to an error message
and exit in case of a successful initialization.  Remove the stray '!'.

Fixes: 12549e27c63c ("clocksource/drivers/time-armada-370-xp: Convert init function to return error")
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1607121731020.1344@hypnos.tec.linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 drivers/clocksource/time-armada-370-xp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index a4e5923..20ec066 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -342,7 +342,7 @@ static int __init armada_370_xp_timer_common_init(struct device_node *np)
 	}
 
 	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
-	if (!res) {
+	if (res) {
 		pr_err("Failed to setup timer");
 		return res;
 	}

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web