From patchwork Thu Jul 7 08:00:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71564 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1283766qgy; Thu, 7 Jul 2016 01:36:27 -0700 (PDT) X-Received: by 10.98.84.197 with SMTP id i188mr3193229pfb.43.1467880585788; Thu, 07 Jul 2016 01:36:25 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si3085273pfc.249.2016.07.07.01.36.25; Thu, 07 Jul 2016 01:36:25 -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 S1756920AbcGGIgY (ORCPT + 30 others); Thu, 7 Jul 2016 04:36:24 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37379 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933337AbcGGIDK (ORCPT ); Thu, 7 Jul 2016 04:03:10 -0400 Received: by mail-wm0-f42.google.com with SMTP id a66so21389976wme.0 for ; Thu, 07 Jul 2016 01:03:04 -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=NxLeAi6EZRKIYZnvtqcFjmL+wRUpuK7rP6ko53PNZCOk60ZHrw3zfm5kX/ZF6I2dPi WO4kixYA9tMmB5RNqfBQ7sqQh7dKrUwA6RJMudQ3VlHiUWnYWXcfc8JZXfZsYjhaYO0V q8vPP9S0VmazNviO/l+PdsiDodDcE9Vr+ToFw= 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=AKrKFFWdxW6j1p6uBL6eXrwm6IAjkTyW3AbaRd8g+LFssrfFLUR6i9qKRSstkRwG8R Vo1dpABDSR2fCApQNSJvf5mtfopTjjhQ50EtLPuaaLa8vnzRyDF1b0DTKqJG+CDK4Lhf xEgfxM5fkw8Jk3bIXdPxyOWtFgBV4NYx9IqRZP4gqXYURrMZvNuYaaFWr76baefqinEZ guzqzJID8ML0V9vOvA6bqELi9PmyhEr7oW1Ce0+Nk+uSs32gNLZRBERvi1aaarWAv55u DVFORn95pbNTZ8YBW5agDGir026X0o1+JuhGdk0/fZv3rUsoy94fsgER6u5B548Depig ONfg== X-Gm-Message-State: ALyK8tI/f4r4aoW5/a2LAD3P1SQPc8HxXlzAfMhur4PWV1aUOX/0deZGOr4A55Xa0V4U7X4h X-Received: by 10.28.176.129 with SMTP id z123mr23858373wme.99.1467878584128; Thu, 07 Jul 2016 01:03:04 -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.03.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 01:03:03 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, daniel.lezcano@linaro.org Cc: linux-kernel@vger.kernel.org, Ray Jui , bcm-kernel-feedback-list@broadcom.com Subject: [PATCH 24/93] clocksource/drivers/bcm_kona: Convert init function to return error Date: Thu, 7 Jul 2016 10:00:57 +0200 Message-Id: <1467878526-1238-24-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 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);