From patchwork Tue Jun 28 10:31:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71040 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1514881qgy; Tue, 28 Jun 2016 03:48:51 -0700 (PDT) X-Received: by 10.66.178.49 with SMTP id cv17mr552082pac.157.1467110930761; Tue, 28 Jun 2016 03:48:50 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l190si33118161pfc.53.2016.06.28.03.48.50; Tue, 28 Jun 2016 03:48:50 -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 S1752888AbcF1Kss (ORCPT + 30 others); Tue, 28 Jun 2016 06:48:48 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:35840 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752401AbcF1Kdq (ORCPT ); Tue, 28 Jun 2016 06:33:46 -0400 Received: by mail-wm0-f50.google.com with SMTP id f126so133914228wma.1 for ; Tue, 28 Jun 2016 03:33:45 -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=nOzD0qRkHsZ/qCtXoZ++WJrr0zcGmHS6g2GILsxgyuM=; b=kFp21b6yGY25mHalnawwIvEHO/ErSyIZs6JM5hXvhpoHWEx0kHsSqrQNlf6bIPzITm zCZOKqgKZCh4S/N7H78m1vpDNAM6XAjCUK4LTGbOWfsPNxauly+cb6R5+VdIT8yBBxqE J9qnyLZezWE2cXSepjFPOphJeURDYk0vqIxqA= 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=nOzD0qRkHsZ/qCtXoZ++WJrr0zcGmHS6g2GILsxgyuM=; b=XXqkgwz9hO3FzOkxjLY8cUaxrQaQnvbnspBuCiiFzBXz3iXFdK9ffOj2wX7CE2yJTs 8WnWlY9mTAmx4Fk319aLHusTBmlY1nZjcbu7Mm0huIa+wIwE0LLsr9ootStFBNu1WL/V /koVkHaTjnbufOiwfkm9tzsrb73MTPJLLd6nRDVAcMpVgNFwz8/haAp6wiwPzFh/btEB T8UJSZXBVASnkixUSchUznCoprfv6JbV94MeJjs0ELJG1l2tm2c+r5MFox9B/SIm+XCI NLtk9XSp5Gf9idVpeLXslHVCRHq4FXkT8DplqqV1+LHGFUzPj43Ze4cWZ14jl/TnSG0K Wrpg== X-Gm-Message-State: ALyK8tLMwkRDvWZQV/z6I51skE+6gqkJQOrIiKrYm+nj4R3T+SATp5TENkIGEBh5veOWxc/l X-Received: by 10.28.107.23 with SMTP id g23mr16206322wmc.101.1467110024747; Tue, 28 Jun 2016 03:33:44 -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 a84sm5377403wma.0.2016.06.28.03.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 03:33:44 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Marc Gonzalez Subject: [PATCH 42/92] clocksource/drivers/tango_xtal: Convert init function to return error Date: Tue, 28 Jun 2016 12:31:01 +0200 Message-Id: <1467109911-11060-42-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467109911-11060-1-git-send-email-daniel.lezcano@linaro.org> References: <577251A4.7030508@linaro.org> <1467109911-11060-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 leave the caller unaware of 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 returns an error code from the init function. Signed-off-by: Daniel Lezcano Acked-by: Marc Gonzalez --- drivers/clocksource/tango_xtal.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/tango_xtal.c b/drivers/clocksource/tango_xtal.c index c407c47..7dc716c 100644 --- a/drivers/clocksource/tango_xtal.c +++ b/drivers/clocksource/tango_xtal.c @@ -19,7 +19,7 @@ static u64 notrace read_sched_clock(void) return read_xtal_counter(); } -static void __init tango_clocksource_init(struct device_node *np) +static int __init tango_clocksource_init(struct device_node *np) { struct clk *clk; int xtal_freq, ret; @@ -27,13 +27,13 @@ static void __init tango_clocksource_init(struct device_node *np) xtal_in_cnt = of_iomap(np, 0); if (xtal_in_cnt == NULL) { pr_err("%s: invalid address\n", np->full_name); - return; + return -ENXIO; } clk = of_clk_get(np, 0); if (IS_ERR(clk)) { pr_err("%s: invalid clock\n", np->full_name); - return; + return PTR_ERR(clk); } xtal_freq = clk_get_rate(clk); @@ -44,11 +44,13 @@ static void __init tango_clocksource_init(struct device_node *np) 32, clocksource_mmio_readl_up); if (ret) { pr_err("%s: registration failed\n", np->full_name); - return; + return ret; } sched_clock_register(read_sched_clock, 32, xtal_freq); register_current_timer_delay(&delay_timer); + + return 0; } -CLOCKSOURCE_OF_DECLARE(tango, "sigma,tick-counter", tango_clocksource_init); +CLOCKSOURCE_OF_DECLARE_RET(tango, "sigma,tick-counter", tango_clocksource_init);