From patchwork Tue Jun 28 10:30:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71043 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1515718qgy; Tue, 28 Jun 2016 03:51:07 -0700 (PDT) X-Received: by 10.66.25.38 with SMTP id z6mr631480paf.11.1467111059826; Tue, 28 Jun 2016 03:50:59 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a63si33102691pfb.33.2016.06.28.03.50.59; Tue, 28 Jun 2016 03:50:59 -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 S1752797AbcF1Kdm (ORCPT + 30 others); Tue, 28 Jun 2016 06:33:42 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:38697 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752740AbcF1Kdd (ORCPT ); Tue, 28 Jun 2016 06:33:33 -0400 Received: by mail-wm0-f44.google.com with SMTP id r201so20894430wme.1 for ; Tue, 28 Jun 2016 03:33:23 -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=4ab3AcDT4y0qmghCv2D7B8rDiHThtzPtqZ8Onw6N6Nw=; b=LuyvfX4sNrKYUSty7ibe8D8RyezWus7fJpjjZSkqXoyZQt0tiHl1FjmiJpnnqPcGwj eaSSWDW8dzsTj1uuozKMCl4ay3GdrMN49lAaYByWWRx/tsDhurSoCN+6rh77v7QQ3RfT Uozl0fXeELsBhSHra9NmlU4/7VDnwPLC5NLz4= 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=4ab3AcDT4y0qmghCv2D7B8rDiHThtzPtqZ8Onw6N6Nw=; b=JAK22MvolVnnHKR0xzPzfNnd7VOCFy5zxB9W7AGv1j/UcT+9JmY31+EzTt+ZFe1JFJ Xs5MjTh5wEWkpHonG00B70xnbGVX8XZ/p+bLH5Fd0McZXH9Bzi6MgArsba84L1di5ZE2 xCWBzvdSfxD8szPtmA63oYI1RzGeM9965KuPKy5TwOEnxekjDe97zSiTtJlws/IGOpqY VfZvxMJV3KgfejThvfTlxSzOfUYJToQpH3zIFh+4J7pUpiAM6bmwK6DkSk0AstSwTo7G kkVJpc3RCBXI5yzvvks3wbs+FAZQGIikQAs5PDhBGe4y9gMhZJULZ3NyZuLvFHsCwHPd yS/g== X-Gm-Message-State: ALyK8tJVI9EqGawvkc2Xp/uTS61BQxh+7O2jyl5DygB4VuzVjJIOp0xGi9TJ64Pbq0psNaoj X-Received: by 10.194.81.166 with SMTP id b6mr2522856wjy.81.1467110002830; Tue, 28 Jun 2016 03:33:22 -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.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 03:33:21 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Ray Jui , bcm-kernel-feedback-list@broadcom.com Subject: [PATCH 24/92] clocksource/drivers/bcm_kona: Convert init function to return error Date: Tue, 28 Jun 2016 12:30:43 +0200 Message-Id: <1467109911-11060-24-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 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: Ray Jui --- drivers/clocksource/bcm_kona_timer.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c index e717e87..c251aa6 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c @@ -163,16 +163,11 @@ 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; - } - external_clk = of_clk_get_by_name(node, NULL); if (!IS_ERR(external_clk)) { @@ -182,7 +177,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 +191,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);