From patchwork Thu Jun 16 21:26:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 70213 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp464426qgy; Thu, 16 Jun 2016 14:28:41 -0700 (PDT) X-Received: by 10.98.41.133 with SMTP id p127mr7523146pfp.18.1466112514979; Thu, 16 Jun 2016 14:28:34 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si20618946pal.94.2016.06.16.14.28.34; Thu, 16 Jun 2016 14:28:34 -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 S1755207AbcFPV21 (ORCPT + 30 others); Thu, 16 Jun 2016 17:28:27 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:35029 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755157AbcFPV2W (ORCPT ); Thu, 16 Jun 2016 17:28:22 -0400 Received: by mail-wm0-f42.google.com with SMTP id v199so207648005wmv.0 for ; Thu, 16 Jun 2016 14:28:21 -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=/IrR4ccR0A7Uo6DkVjWOO+Eigpop0m5sCjeSjyWM3wk=; b=Mg2QJhVa/UnrlGFhknCQJi8+wmWbIMQGf2YTRlQPOoAOk4P9dfKzFiU+C5XJOTsn4E PJZCJTdZztlHoQcdJbI3IVKnzFUoA8J1rsZ8Qr/MVQxwFnfzPS14SVP/VCW2j2Zpf4I8 VPVTvwGtpHKZMItDKRpQQpylxhdwp9SiV7TZ4= 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=/IrR4ccR0A7Uo6DkVjWOO+Eigpop0m5sCjeSjyWM3wk=; b=ebsbcz4sdI1QitkDWS2R9/RqsJ42rxA3Hp1K8tU79uzrleYMpnjS6THwFOc1O3Lp/T qmh1nXlJl8prNOH6x7czYWyjUycN6uHMHbQ+spvvEr9oFHbyH9t8AjwgPCZ27ejtSdNx CeuytLIcOV5sIhJ7BWEsRsQlZ3nVdCn0NSBDGhG9B4LDjnoJ129UOK074DGbxWRLJzEm dWuzcFMquyGYrxiXg4tyemIvquYW1niYSEnr2fyoP9gH/EkBo40pclArNyd8Jcm0psit xrLHEub+RE4UB2Meyh30B6W/mb+A/qvJVA8QEhCZLSn7+nwWm704+RXJ7I0nHH78SNnC ixsg== X-Gm-Message-State: ALyK8tKZBXSaBzPSjslld6CB+6D7ML3x7CjvK8p9Z9BBbjltO6MOVeSd+qh9H/Bg6GaxQdDB X-Received: by 10.195.17.138 with SMTP id ge10mr1648043wjd.94.1466112500999; Thu, 16 Jun 2016 14:28:20 -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.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Jun 2016 14:28:20 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM BCM281XX...) Subject: [PATCH V2 14/63] clocksource/drivers/bcm_kona: Convert init function to return error Date: Thu, 16 Jun 2016 23:26:33 +0200 Message-Id: <1466112442-31105-15-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/bcm_kona_timer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c index e717e87..98bc2a2 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c @@ -163,14 +163,14 @@ static struct irqaction kona_timer_irq = { .handler = kona_timer_interrupt, }; -static void __init kona_timer_init(struct device_node *node) +static int __init kona_timer_init(struct device_node *node) { u32 freq; struct clk *external_clk; if (!of_device_is_available(node)) { pr_info("Kona Timer v1 marked as disabled in device tree\n"); - return; + return 0; } external_clk = of_clk_get_by_name(node, NULL); @@ -182,7 +182,7 @@ static void __init kona_timer_init(struct device_node *node) arch_timer_rate = freq; } else { pr_err("Kona Timer v1 unable to determine clock-frequency"); - return; + return -EINVAL; } /* Setup IRQ numbers */ @@ -196,11 +196,13 @@ static void __init kona_timer_init(struct device_node *node) kona_timer_clockevents_init(); setup_irq(timers.tmr_irq, &kona_timer_irq); kona_timer_set_next_event((arch_timer_rate / HZ), NULL); + + return 0; } -CLOCKSOURCE_OF_DECLARE(brcm_kona, "brcm,kona-timer", kona_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(brcm_kona, "brcm,kona-timer", kona_timer_init); /* * bcm,kona-timer is deprecated by brcm,kona-timer * being kept here for driver compatibility */ -CLOCKSOURCE_OF_DECLARE(bcm_kona, "bcm,kona-timer", kona_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(bcm_kona, "bcm,kona-timer", kona_timer_init);