From patchwork Tue Jun 28 10:30:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71046 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1515930qgy; Tue, 28 Jun 2016 03:51:42 -0700 (PDT) X-Received: by 10.98.41.198 with SMTP id p189mr683633pfp.18.1467111102219; Tue, 28 Jun 2016 03:51:42 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si33127136pfj.19.2016.06.28.03.51.41; Tue, 28 Jun 2016 03:51:42 -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 S1753233AbcF1Kvj (ORCPT + 30 others); Tue, 28 Jun 2016 06:51:39 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37897 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752366AbcF1Kdi (ORCPT ); Tue, 28 Jun 2016 06:33:38 -0400 Received: by mail-wm0-f46.google.com with SMTP id r201so20904237wme.1 for ; Tue, 28 Jun 2016 03:33:38 -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=BElfppqY2TMLuSeu9Zl2L1IFinCMwmj4Q1snTxPz17Q=; b=gm3DXRbOXaALyYc6acvRSnLIH4qXt06GHneirQeW5Tg2oJCUWTCNdfVp90jVZpY4wx 814IwvhvowBxdyt5sRvo4bpDt/esGeQQgWuedz137WGL13MahBItb//TDPWBQ/AUYWwF 798CHbiMsKoDRm5gqi/gm5Tzz18i74eZRNvA4= 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=BElfppqY2TMLuSeu9Zl2L1IFinCMwmj4Q1snTxPz17Q=; b=hzCJNVkRpmujdJhDe591fNkLGXcOkon5bDymgIvDcE710TcjRy43LOjMgd3WKRLZzM fYhDKpl89GdONG+gV8T0hB5Jkm+iS7nLX61nbjwGKKuhsksQnp0o75iMCnVoAHr+pKkq 4mcHat37FfgJJ3xtekn+cyIh2w6fH+IJYDxoVxpT0v6yHgiEf3+hMywq/TUbb+cPA0SA asbRUQKMy7mCcrLltnFpyDG0ctC4yv8sjaAxh9VxqPXH2flZh2CL41Lus7sI5e4dA/2x RBegam2OLTJY4aBy4DYJmRhf6FC7NOAtbQp6DSV0FCw7rdJhA+EQrWQbN09SQlqKD14e rcRA== X-Gm-Message-State: ALyK8tIpsWrfePD9gSdmIBVAmCGSlcM3hDex25Dd3kiqd4RTmZRsG0ZALUUI0kq0bAXYyEsn X-Received: by 10.28.218.71 with SMTP id r68mr16177244wmg.48.1467110017460; Tue, 28 Jun 2016 03:33:37 -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.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 03:33:37 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org Subject: [PATCH 36/92] clocksource/drivers/mxs: Convert init function to return error Date: Tue, 28 Jun 2016 12:30:55 +0200 Message-Id: <1467109911-11060-36-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 function does not return any error, it prints a message, returns and lets 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/mxs_timer.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/mxs_timer.c b/drivers/clocksource/mxs_timer.c index f5ce296..17b9d19 100644 --- a/drivers/clocksource/mxs_timer.c +++ b/drivers/clocksource/mxs_timer.c @@ -226,10 +226,10 @@ static int __init mxs_clocksource_init(struct clk *timer_clk) return 0; } -static void __init mxs_timer_init(struct device_node *np) +static int __init mxs_timer_init(struct device_node *np) { struct clk *timer_clk; - int irq; + int irq, ret; mxs_timrot_base = of_iomap(np, 0); WARN_ON(!mxs_timrot_base); @@ -237,10 +237,12 @@ static void __init mxs_timer_init(struct device_node *np) timer_clk = of_clk_get(np, 0); if (IS_ERR(timer_clk)) { pr_err("%s: failed to get clk\n", __func__); - return; + return PTR_ERR(timer_clk); } - clk_prepare_enable(timer_clk); + ret = clk_prepare_enable(timer_clk); + if (ret) + return ret; /* * Initialize timers to a known state @@ -278,11 +280,19 @@ static void __init mxs_timer_init(struct device_node *np) mxs_timrot_base + HW_TIMROT_FIXED_COUNTn(1)); /* init and register the timer to the framework */ - mxs_clocksource_init(timer_clk); - mxs_clockevent_init(timer_clk); + ret = mxs_clocksource_init(timer_clk); + if (ret) + return ret; + + ret = mxs_clockevent_init(timer_clk); + if (ret) + return ret; /* Make irqs happen */ irq = irq_of_parse_and_map(np, 0); - setup_irq(irq, &mxs_timer_irq); + if (irq <= 0) + return -EINVAL; + + return setup_irq(irq, &mxs_timer_irq); } -CLOCKSOURCE_OF_DECLARE(mxs, "fsl,timrot", mxs_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(mxs, "fsl,timrot", mxs_timer_init);