From patchwork Wed Jun 1 08:34:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 9146381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7D4C60761 for ; Wed, 1 Jun 2016 08:36:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7A3520410 for ; Wed, 1 Jun 2016 08:36:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAFEA26785; Wed, 1 Jun 2016 08:36:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 418F220410 for ; Wed, 1 Jun 2016 08:36:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b81dK-0004Ey-JZ; Wed, 01 Jun 2016 08:36:10 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b81d7-0003iR-0j for linux-rockchip@lists.infradead.org; Wed, 01 Jun 2016 08:35:58 +0000 Received: by mail-wm0-x235.google.com with SMTP id n184so19432949wmn.1 for ; Wed, 01 Jun 2016 01:35:36 -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=tcHHeb4h3AyqMN6BUhTKfzxL6/W40TZFpedlfDWvNSQ=; b=dgQhQyzE09bIAlektNp7bZ8qTOqsnmyebLz0AgGFfmtMkv0u3kN26ueyQh2Cfi319P hfCY4+z14/jSqpPUpnnhGWm7JoROul8qgm6wJIOapXeqe8pawAAY9L8RTYTYkgZAvsDm 392bzc+LTIvnMXzQi0CZymQ3xwrYi49EURht0= 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=tcHHeb4h3AyqMN6BUhTKfzxL6/W40TZFpedlfDWvNSQ=; b=Q++xf88IhQqwuO+L4e0NvidwMoPSh4RJTxgqHHbEYsykVHsZOPGX1oAgRo5jzwgyyE EF4aW19GG7zymSo94Z8YPJ7zsWDIwW+LjGSoJnp27zFAA1J2ir5IgNt+IeERGSwhXEH9 h9BA2b6qaRrSMP+twNtgKqMXdD8Ia9r/ahvTXvCVVp/2kJ0WFXtw/rHuPS72A4i9OrdT +ZPyNIyiUl3+X6XGMY+VLMkpMd62xae4k4JKJUVoWDv5ns9Og++dTXhbEqtTREPZ+rS7 BrKwGDXldZwDCwfAGRt7TZncWod+gjd0xi3SMXf6smCh4R92km84XqU9JiMzSAd5ini9 a8YA== X-Gm-Message-State: ALyK8tKo2omslwTm3J/dRUjfDmdPrIKrsb1vQ9OrqvObyyhy48EjcGOSCUyL+5kayssTGl0w X-Received: by 10.194.206.39 with SMTP id ll7mr2209983wjc.179.1464770135369; Wed, 01 Jun 2016 01:35:35 -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 t3sm33542865wmf.20.2016.06.01.01.35.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jun 2016 01:35:34 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Subject: [PATCH 3/9] clocksource/drivers/rockchip_timer: Convert init function to return error Date: Wed, 1 Jun 2016 10:34:46 +0200 Message-Id: <1464770093-12667-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464770093-12667-1-git-send-email-daniel.lezcano@linaro.org> References: <1464770093-12667-1-git-send-email-daniel.lezcano@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160601_013557_306197_64B2F43A X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:ARM/Rockchip SoC..." , linux-kernel@vger.kernel.org, "moderated list:ARM/Rockchip SoC..." , Heiko Stuebner MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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/rockchip_timer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c index b991b28..36b0209 100644 --- a/drivers/clocksource/rockchip_timer.c +++ b/drivers/clocksource/rockchip_timer.c @@ -106,17 +106,17 @@ static irqreturn_t rk_timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static void __init rk_timer_init(struct device_node *np) +static int __init rk_timer_init(struct device_node *np) { struct clock_event_device *ce = &bc_timer.ce; struct clk *timer_clk; struct clk *pclk; - int ret, irq; + int ret = -EINVAL, irq; bc_timer.base = of_iomap(np, 0); if (!bc_timer.base) { pr_err("Failed to get base address for '%s'\n", TIMER_NAME); - return; + return -ENXIO; } pclk = of_clk_get_by_name(np, "pclk"); @@ -169,7 +169,7 @@ static void __init rk_timer_init(struct device_node *np) clockevents_config_and_register(ce, bc_timer.freq, 1, UINT_MAX); - return; + return 0; out_irq: clk_disable_unprepare(timer_clk); @@ -177,6 +177,8 @@ out_timer_clk: clk_disable_unprepare(pclk); out_unmap: iounmap(bc_timer.base); + + return ret; } -CLOCKSOURCE_OF_DECLARE(rk_timer, "rockchip,rk3288-timer", rk_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(rk_timer, "rockchip,rk3288-timer", rk_timer_init);