From patchwork Tue Jun 28 10:30:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 70993 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1509453qgy; Tue, 28 Jun 2016 03:33:56 -0700 (PDT) X-Received: by 10.98.68.84 with SMTP id r81mr583949pfa.26.1467110036241; Tue, 28 Jun 2016 03:33:56 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 6si33071643pfe.203.2016.06.28.03.33.55; Tue, 28 Jun 2016 03:33:56 -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 S1752827AbcF1Kdr (ORCPT + 30 others); Tue, 28 Jun 2016 06:33:47 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38627 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752731AbcF1Kdd (ORCPT ); Tue, 28 Jun 2016 06:33:33 -0400 Received: by mail-wm0-f47.google.com with SMTP id r201so20891332wme.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=kUj2NaHxwKgegK48SG4g5Z8uY+Ljp4XXnqEBJA5QBWo=; b=DSqf7lA7wqAutIgwyo9RrtMSRu6slb1WrlCNbf7YdELn0yyTmd6E1BSLUXWOtslBDK 9STRrQkCxGYOgmWBQuwP3g8UOWsXquhizLZ9lFoVLUMe5T920rWRoPAHwUwLs+xQXNCD daVEqI8vi5IRHjhkgt2UWYddPuiddM4zK9PXc= 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=kUj2NaHxwKgegK48SG4g5Z8uY+Ljp4XXnqEBJA5QBWo=; b=ax2vHauWqPvRS8NXEcYpyOZwwv5LHoYkjnRbt4+upl5te5HcF1ahwdXUL1S/yJyOkU dCzG/5eWLapPwH7YSbKxckP4y/WnQ2Yvzddo56EfQAjMkR85b3xpZVKeXKiwPuti1voO 9+k8Oen/ySn/nKLIyrzlCdG33Q3dVIWyYBea3rUdZSRpOHpR40JfWcivkDAsV1+RRaYa aTLFVBW/OWCh4zxH7BbR/cMaVKNwaudf6q/jYhdMgUffk1jT8dBfvgztQ00ONp8hhA7J K7QsR1PFd3efLR+lGF06hubIqcD2wvwLXGoJmDizvtUzisf+aDKhr/AdCfBnmgDW0dAx OZvQ== X-Gm-Message-State: ALyK8tKfT/7kVn6qS27We4/kWlMr31wZqTwWnKKuIX0we7HeBRkd0LLjI63LHFAnBuc44jvO X-Received: by 10.194.116.195 with SMTP id jy3mr2635061wjb.36.1467109998081; Tue, 28 Jun 2016 03:33:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 03:33:17 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Baruch Siach , linux-arm-kernel@lists.infradead.org Subject: [PATCH 21/92] clocksource/drivers/digicolor: Convert init function to return error Date: Tue, 28 Jun 2016 12:30:40 +0200 Message-Id: <1467109911-11060-21-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: Baruch Siach --- drivers/clocksource/timer-digicolor.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/timer-digicolor.c b/drivers/clocksource/timer-digicolor.c index 96bb222..b929061 100644 --- a/drivers/clocksource/timer-digicolor.c +++ b/drivers/clocksource/timer-digicolor.c @@ -148,7 +148,7 @@ static u64 notrace digicolor_timer_sched_read(void) return ~readl(dc_timer_dev.base + COUNT(TIMER_B)); } -static void __init digicolor_timer_init(struct device_node *node) +static int __init digicolor_timer_init(struct device_node *node) { unsigned long rate; struct clk *clk; @@ -161,19 +161,19 @@ static void __init digicolor_timer_init(struct device_node *node) dc_timer_dev.base = of_iomap(node, 0); if (!dc_timer_dev.base) { pr_err("Can't map registers"); - return; + return -ENXIO; } irq = irq_of_parse_and_map(node, dc_timer_dev.timer_id); if (irq <= 0) { pr_err("Can't parse IRQ"); - return; + return -EINVAL; } clk = of_clk_get(node, 0); if (IS_ERR(clk)) { pr_err("Can't get timer clock"); - return; + return PTR_ERR(clk); } clk_prepare_enable(clk); rate = clk_get_rate(clk); @@ -190,13 +190,17 @@ static void __init digicolor_timer_init(struct device_node *node) ret = request_irq(irq, digicolor_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, "digicolor_timerC", &dc_timer_dev.ce); - if (ret) + if (ret) { pr_warn("request of timer irq %d failed (%d)\n", irq, ret); + return ret; + } dc_timer_dev.ce.cpumask = cpu_possible_mask; dc_timer_dev.ce.irq = irq; clockevents_config_and_register(&dc_timer_dev.ce, rate, 0, 0xffffffff); + + return 0; } -CLOCKSOURCE_OF_DECLARE(conexant_digicolor, "cnxt,cx92755-timer", +CLOCKSOURCE_OF_DECLARE_RET(conexant_digicolor, "cnxt,cx92755-timer", digicolor_timer_init);