From patchwork Thu Jun 16 21:26:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 70219 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp464715qgy; Thu, 16 Jun 2016 14:29:27 -0700 (PDT) X-Received: by 10.107.159.84 with SMTP id i81mr10878022ioe.29.1466112555798; Thu, 16 Jun 2016 14:29:15 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l17si7967338pfa.42.2016.06.16.14.29.15; Thu, 16 Jun 2016 14:29:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755327AbcFPV24 (ORCPT + 30 others); Thu, 16 Jun 2016 17:28:56 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:37018 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755305AbcFPV2v (ORCPT ); Thu, 16 Jun 2016 17:28:51 -0400 Received: by mail-wm0-f41.google.com with SMTP id a66so75550446wme.0 for ; Thu, 16 Jun 2016 14:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H2imLzOZLFR7qE4obDa3BrVs74DdtAHfNmfEqRy+HSY=; b=YbeHb7ANNmcw6m2s0PY4yFCKksn8YjErdIAQ7IYqCU3sCdwtv6CHQ1rIzEGNdXxUqo 5XO7BRTMlsWztqFcAVZcdpuEQPsFNWRovVgzkgkb4cLJpMkCG9tmw9E9XsLyYbM+DPVT YTfoDQNktjZgEldS7mBIYCi68jbPqsdbl4+sg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H2imLzOZLFR7qE4obDa3BrVs74DdtAHfNmfEqRy+HSY=; b=dOiilOC1Z+TPdTmtwH4UkGMm+65ZHciYJM9dKGjhltzXyh0b/lKPye0YQe0wbYEGo3 543IgfChGaS7OG2BqL2eaOr57yqEryRRsBOvK//o8j+zHWYBtJXC8bCCuUNFt+Xg/sYV HszXOwm8CRpDfF+MgYuASP/WgZCIwrxgyCbgXGGFZuZP3JVTrQ9n2paoLGNYT747iTHG ZxZIzmiBR5SYkFLHcXn8Z0IzHsv6DYrNbEc5qE7/NZErCDpBoFllRdh0mqR+wlDeqYxp 28V6Dj91q2xWPPt4Iu5hKWvQ3ikNCxPShE5FtvAu7MHxX+k8b8yfMnR5V3VpxLseWGvA X+Lw== X-Gm-Message-State: ALyK8tK9HvafH5pSUdgY/zr7IiXJ4xCpI9lcj0oyu5qZNGzO4zBqX566Qxyinx7uMoFbKWUU X-Received: by 10.28.38.5 with SMTP id m5mr17824493wmm.82.1466112530361; Thu, 16 Jun 2016 14:28:50 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id x128sm16705606wmf.6.2016.06.16.14.28.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Jun 2016 14:28:49 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Joachim Eastwood , Vladimir Zapolskiy , Sylvain Lemieux , linux-arm-kernel@lists.infradead.org (moderated list:ARM/LPC18XX ARCHI...) Subject: [PATCH V2 36/63] clocksource/drivers/time-orion: Convert init function to return error Date: Thu, 16 Jun 2016 23:26:55 +0200 Message-Id: <1466112442-31105-37-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466112442-31105-1-git-send-email-daniel.lezcano@linaro.org> References: <1466112442-31105-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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-lpc32xx.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/time-lpc32xx.c b/drivers/clocksource/time-lpc32xx.c index daae61e..cb5b866 100644 --- a/drivers/clocksource/time-lpc32xx.c +++ b/drivers/clocksource/time-lpc32xx.c @@ -288,16 +288,16 @@ err_clk_enable: * This function asserts that we have exactly one clocksource and one * clock_event_device in the end. */ -static void __init lpc32xx_timer_init(struct device_node *np) +static int __init lpc32xx_timer_init(struct device_node *np) { static int has_clocksource, has_clockevent; - int ret; + int ret = 0; if (!has_clocksource) { ret = lpc32xx_clocksource_init(np); if (!ret) { has_clocksource = 1; - return; + return 0; } } @@ -305,8 +305,10 @@ static void __init lpc32xx_timer_init(struct device_node *np) ret = lpc32xx_clockevent_init(np); if (!ret) { has_clockevent = 1; - return; + return 0; } } + + return ret; } -CLOCKSOURCE_OF_DECLARE(lpc32xx_timer, "nxp,lpc3220-timer", lpc32xx_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(lpc32xx_timer, "nxp,lpc3220-timer", lpc32xx_timer_init);