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: 9181679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7D1960776 for ; Thu, 16 Jun 2016 21:33:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B975C27F07 for ; Thu, 16 Jun 2016 21:33:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE44228389; Thu, 16 Jun 2016 21:33:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4EF8027F07 for ; Thu, 16 Jun 2016 21:33:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bDeti-0000FV-Is; Thu, 16 Jun 2016 21:32:22 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bDeqY-0003GW-VH for linux-arm-kernel@lists.infradead.org; Thu, 16 Jun 2016 21:29:09 +0000 Received: by mail-wm0-x230.google.com with SMTP id r190so34410081wmr.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=fC8ud1lF2AX0clGaau1tVmapUUGMB7JPyvL/YhiQvhGNGvcLuFE3+MN9an2IdsnPVg +RE85+/FdNgCRhuvE8L0UXvFMMUr8dNj2NrnZYyGZwVnanskdbFgJ8UYfcfbxDiv1IyV S+Lf0wM19/MeSd7cWgzeGRKWWYhUI+ronCvN/DO7fAqaIU8E/p3n+KP7ruoEAuBWKzhD +A9KqvtvKNrgbLH6oMWIvJ69BaKaVPTYTOF1cZTWpa0BDjgcnMQoUI/+mNwRsKdrazWw 426oZnZl1bP9AIrArildN/sxc9C+dY377rT80KHkfnZMoxhIOjcwOqwXlv+Oj6OhJiSf iO7A== X-Gm-Message-State: ALyK8tJA6sAlE6nxre1TtRI4Fp1NLtNv5Tg7qGcuEC0rBZR12VrSktdVnH932lA1oFNHCS3U 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160616_142907_413356_BA3ADF0D X-CRM114-Status: GOOD ( 15.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joachim Eastwood , Sylvain Lemieux , linux-kernel@vger.kernel.org, "moderated list:ARM/LPC18XX ARCHI..." , Vladimir Zapolskiy MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Sylvain Lemieux --- drivers/clocksource/time-lpc32xx.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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);