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: 9202739 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 EC6BE6075F for ; Tue, 28 Jun 2016 10:43:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE736285F9 for ; Tue, 28 Jun 2016 10:43:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D39BF28600; Tue, 28 Jun 2016 10:43:46 +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 6187F285F9 for ; Tue, 28 Jun 2016 10:43:46 +0000 (UTC) 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-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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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);