From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933527AbcGLPcQ (ORCPT ); Tue, 12 Jul 2016 11:32:16 -0400 Received: from www.linutronix.de ([62.245.132.108]:34851 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933462AbcGLPcP (ORCPT ); Tue, 12 Jul 2016 11:32:15 -0400 Date: Tue, 12 Jul 2016 17:33:32 +0200 (CEST) From: Anna-Maria Gleixner To: Daniel Lezcano cc: tglx@linutronix.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH 44/93] clocksource/drivers/time-armada-370-xp: Convert init function to return error In-Reply-To: Message-ID: References: <577E0BED.3020608@linaro.org> <1467878526-1238-1-git-send-email-daniel.lezcano@linaro.org> <1467878526-1238-44-git-send-email-daniel.lezcano@linaro.org> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > --- > > 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 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 --- 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; }