From patchwork Tue Jun 28 10:31:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71034 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1512887qgy; Tue, 28 Jun 2016 03:42:50 -0700 (PDT) X-Received: by 10.66.134.35 with SMTP id ph3mr587509pab.98.1467110570430; Tue, 28 Jun 2016 03:42:50 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id yf10si5027301pab.121.2016.06.28.03.42.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 03:42:50 -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 1bHqSO-0001we-Dq; Tue, 28 Jun 2016 10:41:28 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHqLM-0006eY-4O for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2016 10:34:13 +0000 Received: by mail-wm0-x231.google.com with SMTP id f126so133917669wma.1 for ; Tue, 28 Jun 2016 03:33:52 -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=V8rPDmcnh3hansKataRbWlKy7+qzy5c4YVKbre0MFC3i/R+D/GZfCoSBKJAGAgTPk0 5DmbGc8plyUsxaqi4SB354iuvZrl93IjmSMtByRZ4aVKpR6QqOYdVVu2ygZZNK+kGIiw AQ8eIaSi3oNxTi3HwhsEEYlf7owv/zDal3xcU= 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=KCHCoptGL8V5xUNVTZIvlzf/XFNlHsIKl1pH7YP/V9lnpdvJsI6FKZnEDq9HIx+bj5 Rb3yC4S/Y3ycBmLqviAufMpa7ZiKy61qIVtRYoMm4ZKXPm3IJBlNZr1KDYFMm9pACsbH hAEvwXyacNpg5rl6pScosLW+7F3XdBJFT2z+6z1A/1ffxgxChbJ5k2X7igtBt+GaWGvh p1Oscf5bPsq707k5Nx0EjfyEZoKTRwbqsyO69QRqz7DSmCm/cFRHRhi8dIO+gPHQ+dX+ d1b8boepjcP4Pr00e7ukVdO0oZiBIUq9xGEF9cRoHwsT1Lhn5x2szdEoJgcftqNO4Jrf Lc+w== X-Gm-Message-State: ALyK8tLL6mnQq9eiUOX4gqc1E2SRADQlGuFgW59GBPf+ktbHNGd2Kxw/aZ9nvbXPSZtLy0yq X-Received: by 10.28.16.193 with SMTP id 184mr2913444wmq.62.1467110030745; Tue, 28 Jun 2016 03:33:50 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 03:33:50 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Subject: [PATCH 45/92] clocksource/drivers/time-efm32: Convert init function to return error Date: Tue, 28 Jun 2016 12:31:04 +0200 Message-Id: <1467109911-11060-45-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160628_033412_540238_DAC5BD5F X-CRM114-Status: GOOD ( 15.21 ) 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:231 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);