From patchwork Fri Jun 17 08:44:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 9183075 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 3F5BC6075F for ; Fri, 17 Jun 2016 08:46:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 353AC262F2 for ; Fri, 17 Jun 2016 08:46:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A1582839C; Fri, 17 Jun 2016 08:46:34 +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=unavailable 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 D7586262F2 for ; Fri, 17 Jun 2016 08:46:33 +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 1bDpOh-0005iB-IG; Fri, 17 Jun 2016 08:45:03 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bDpOd-0005Te-Q6 for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2016 08:45:01 +0000 Received: by mail-wm0-x22f.google.com with SMTP id a66so91050928wme.0 for ; Fri, 17 Jun 2016 01:44: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=gE6P6TcTOmXaIUGBdQ4Ccx5BslxOaXr2MZlV1YDhuoc=; b=bMsC/IZZCtYsUniJcxDLQLbKtb1VIh3JGDbYVL7UtPYXAadWJuTQi/MU/j+EZOO5sC c0cYf8H/8CVxm2mdGwWFv3qLBjt1vDpJluYdjG0fCvxwJdLy9fOtg3ji9nIJSGowBkdT pcJ7sEeN6nqIf1HVsLqqz0Khv2Hq3z4J8sUHI= 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=gE6P6TcTOmXaIUGBdQ4Ccx5BslxOaXr2MZlV1YDhuoc=; b=JmvWOC6FMUesnCzf765v9GSGskEbykrtgnKg2N2M94lJ1VItoCT8gmf+9R3dr/zrXv igLWhuxBQJBhtRNIk5xQO+rhSTetVhJTc+9aHDPCGsoPdcf62IwLrYrmEJCCwQcm3ifO 1u4rmU09j2m2oCXk8UAQYe6LhXkgSiFo6+LHTejpglhMrLFNc1DR/92WwJQ2n3d0BtFm 4N6vSAuoVIwvOeMOsSmXXrRFsj1NTq6EUmaUI+/nEKm7jS5g6LkR9FNhqfMhYCXaKkRX 7WKMA+wxWPw2qvjg+MR/lm3h3U04tiCAzI42WsDU8VVHuB6FVHBSk8qjk/5XkKnVX78E jTpw== X-Gm-Message-State: ALyK8tLJ7demE0kmVpc+b4TyRrN9/gFv7UwSZiHItRySSFu3v1RHph8wTAiwNjuQD9ghtimP X-Received: by 10.28.142.144 with SMTP id q138mr1128265wmd.30.1466153077603; Fri, 17 Jun 2016 01:44: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 l4sm1916678wml.21.2016.06.17.01.44.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 01:44:36 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de, kernel@pengutronix.de Subject: [PATCH V3] clocksource/drivers/time-efm32: Convert init function to return error Date: Fri, 17 Jun 2016 10:44:19 +0200 Message-Id: <1466153059-16820-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <20160617065250.GU26048@pengutronix.de> References: <20160617065250.GU26048@pengutronix.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160617_014500_010111_9BE21F4D X-CRM114-Status: GOOD ( 14.67 ) 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 MIME-Version: 1.0 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);