From patchwork Thu Jul 7 08:01:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71528 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1273872qgy; Thu, 7 Jul 2016 01:09:14 -0700 (PDT) X-Received: by 10.98.112.196 with SMTP id l187mr3005575pfc.59.1467878954553; Thu, 07 Jul 2016 01:09:14 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id a63si2879191pfb.33.2016.07.07.01.09.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jul 2016 01:09:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bL4LY-0002yz-Oc; Thu, 07 Jul 2016 08:07:44 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bL4Hw-0004to-GD for linux-arm-kernel@lists.infradead.org; Thu, 07 Jul 2016 08:04:03 +0000 Received: by mail-wm0-x234.google.com with SMTP id z126so138057136wme.0 for ; Thu, 07 Jul 2016 01:03:40 -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 :mime-version:content-transfer-encoding; bh=U6YJKiQY8/qR+3m/mLFhJg/4h+XlSdk6KPRLLE2DwO8=; b=DxLIGyP4WhrgfaVKOg5OjQ0rM/ur5t9KlllcPkJxukcGzRbLXxSEug+U9ECwh4VDSc JlOnuP8ZI86A1FaydYSB443vSCJhBXUh3/Ei5+EufipduVv2Uok7pjUDY2TLsXdPJv6b H07mLwSeREHsNJOJZgfJ+wcvJAqtm70Bigajk= 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:mime-version:content-transfer-encoding; bh=U6YJKiQY8/qR+3m/mLFhJg/4h+XlSdk6KPRLLE2DwO8=; b=iajmfXqRldHTZYKAzuneg/KPs97kDc1hClRmitANujFfocu5/ci9ZE4vZ4f43P8ppV pPzu9HFLfiMmQxb6qpzJ5leID3SKV0WiS+UdVk4rSMulPI7lKy8KSYeqTqQY07WxDBym fAzCfJArYaZpZDpVvO3BGpzG7z+FydU40rZCSQ8E0rYwSPbbRxQGGaXYmq2bRhJ8WuOQ BQqS1JslLdYCgBgWF7CUDKwERETIgNf3Wgn6sI3m3rcieGn+YuN4uAu07McmpMQQnX21 TEe/uQk6FJDjyJZe1kBWNYNfZV4WEnFlF6TFTR+jeFwQJKdhCT5TK2NqAo3j4Lu88aJk S13g== X-Gm-Message-State: ALyK8tLVJqPWp2kakj0v7FPww6DgSHCMVA46OW7zAYZZkPfxqnUc449gZITLCyjGflhQAJbn X-Received: by 10.194.54.102 with SMTP id i6mr23079246wjp.91.1467878618897; Thu, 07 Jul 2016 01:03:38 -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.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 01:03:38 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, daniel.lezcano@linaro.org Subject: [PATCH 45/93] clocksource/drivers/time-efm32: Convert init function to return error Date: Thu, 7 Jul 2016 10:01:18 +0200 Message-Id: <1467878526-1238-45-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160707_010400_828719_CF29F567 X-CRM114-Status: GOOD ( 14.79 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:234 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The init functions do not return any error and let the caller unaware of 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: Uwe Kleine-König --- drivers/clocksource/time-efm32.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/clocksource/time-efm32.c b/drivers/clocksource/time-efm32.c index b06e4c2..6e2f79f 100644 --- a/drivers/clocksource/time-efm32.c +++ b/drivers/clocksource/time-efm32.c @@ -233,10 +233,15 @@ static int __init efm32_clockevent_init(struct device_node *np) DIV_ROUND_CLOSEST(rate, 1024), 0xf, 0xffff); - setup_irq(irq, &efm32_clock_event_irq); + ret = setup_irq(irq, &efm32_clock_event_irq); + if (ret) { + pr_err("Failed setup irq"); + goto err_setup_irq; + } return 0; +err_setup_irq: err_get_irq: iounmap(base); @@ -255,16 +260,16 @@ err_clk_get: * This function asserts that we have exactly one clocksource and one * clock_event_device in the end. */ -static void __init efm32_timer_init(struct device_node *np) +static int __init efm32_timer_init(struct device_node *np) { static int has_clocksource, has_clockevent; - int ret; + int ret = 0; if (!has_clocksource) { ret = efm32_clocksource_init(np); if (!ret) { has_clocksource = 1; - return; + return 0; } } @@ -272,9 +277,11 @@ static void __init efm32_timer_init(struct device_node *np) ret = efm32_clockevent_init(np); if (!ret) { has_clockevent = 1; - return; + return 0; } } + + return ret; } -CLOCKSOURCE_OF_DECLARE(efm32compat, "efm32,timer", efm32_timer_init); -CLOCKSOURCE_OF_DECLARE(efm32, "energymicro,efm32-timer", efm32_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(efm32compat, "efm32,timer", efm32_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(efm32, "energymicro,efm32-timer", efm32_timer_init);