From patchwork Thu Jul 7 08:01:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71545 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1278066qgy; Thu, 7 Jul 2016 01:19:39 -0700 (PDT) X-Received: by 10.66.88.131 with SMTP id bg3mr17439998pab.43.1467879579751; Thu, 07 Jul 2016 01:19:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p90si3056478pfj.284.2016.07.07.01.19.39; Thu, 07 Jul 2016 01:19:39 -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 S1756866AbcGGITg (ORCPT + 30 others); Thu, 7 Jul 2016 04:19:36 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37158 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030292AbcGGIEK (ORCPT ); Thu, 7 Jul 2016 04:04:10 -0400 Received: by mail-wm0-f42.google.com with SMTP id a66so21424981wme.0 for ; Thu, 07 Jul 2016 01:04:10 -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=pXeDflHQGdqnqPISHUMBFmCrHD+I8PCh7rC7AxPOnEo=; b=ZUmCneGemSiB4TASrc7w3A6kU5QGBTVgsq2cjh52cWWgeFpd0kzSniin71T6+H9vax 5YugN50b1ByX3Q4OJ3cTNuj0dHzuDHzlEUYTI4EGy5xEbMLBrPyPM7MlKnOvTdTdr9my ZcYe45aQYaTsqn7sXJbLVA+9tWH1QaTCFculQ= 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=pXeDflHQGdqnqPISHUMBFmCrHD+I8PCh7rC7AxPOnEo=; b=kVr32aZD4gDBUq/eAmGLByRy6vmPntPUl30UjaNlnE1O6fE4GO+eDkS45/TE41wGMT GlTrbRmbDki4L4YKSRX2a5uv84f9MtUp7D2DvP4N0K2LDeIVhbh70EiufOOLtD7WZRMl LAyKQIoxqCNAVMJfW/JAXXl1kc1uhf0yVoENAGjuMpXrRjKJSCY3CWa/xrfp9gOWTUsb 0pe3dPFL39A+N/TT1VXIDiKIPIKPYMUbeN1B4cTMkVRbh/gOvx0f8ahWDw6ZVYJus0CX SeLyio0oTqDJ/VC034+9KpmPQBVpJyMMtl9hGKLOcl15/j3H3LxnNCvcLxFG6U9WqxLC cFGQ== X-Gm-Message-State: ALyK8tI0bUeEfpEhcTBFKktvZpGX2uv5SxyTdrHs5CLlE7Z5ZzosO1sLgXuwEZvSzhzA7m7h X-Received: by 10.194.239.197 with SMTP id vu5mr11542521wjc.111.1467878649368; Thu, 07 Jul 2016 01:04:09 -0700 (PDT) Received: from localhost.localdomain (lft31-1-88-121-166-205.fbx.proxad.net. [88.121.166.205]) by smtp.gmail.com with ESMTPSA id v70sm51327wmf.18.2016.07.07.01.04.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 01:04:08 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, daniel.lezcano@linaro.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 69/93] clocksource/drivers/nps: Convert init function to return error Date: Thu, 7 Jul 2016 10:01:42 +0200 Message-Id: <1467878526-1238-69-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467878526-1238-1-git-send-email-daniel.lezcano@linaro.org> References: <577E0BED.3020608@linaro.org> <1467878526-1238-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 Signed-off-by: Arnd Bergmann --- drivers/clocksource/timer-nps.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/timer-nps.c b/drivers/clocksource/timer-nps.c index d461089..b5c7b2b 100644 --- a/drivers/clocksource/timer-nps.c +++ b/drivers/clocksource/timer-nps.c @@ -55,8 +55,8 @@ static cycle_t nps_clksrc_read(struct clocksource *clksrc) return (cycle_t)ioread32be(nps_msu_reg_low_addr[cluster]); } -static void __init nps_setup_clocksource(struct device_node *node, - struct clk *clk) +static int __init nps_setup_clocksource(struct device_node *node, + struct clk *clk) { int ret, cluster; @@ -68,7 +68,7 @@ static void __init nps_setup_clocksource(struct device_node *node, ret = clk_prepare_enable(clk); if (ret) { pr_err("Couldn't enable parent clock\n"); - return; + return ret; } nps_timer_rate = clk_get_rate(clk); @@ -79,20 +79,22 @@ static void __init nps_setup_clocksource(struct device_node *node, pr_err("Couldn't register clock source.\n"); clk_disable_unprepare(clk); } + + return ret; } -static void __init nps_timer_init(struct device_node *node) +static int __init nps_timer_init(struct device_node *node) { struct clk *clk; clk = of_clk_get(node, 0); if (IS_ERR(clk)) { pr_err("Can't get timer clock.\n"); - return; + return PTR_ERR(clk); } - nps_setup_clocksource(node, clk); + return nps_setup_clocksource(node, clk); } -CLOCKSOURCE_OF_DECLARE(ezchip_nps400_clksrc, "ezchip,nps400-timer", - nps_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(ezchip_nps400_clksrc, "ezchip,nps400-timer", + nps_timer_init);