From patchwork Mon Jun 20 09:26:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 70421 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1417366qgy; Mon, 20 Jun 2016 02:28:40 -0700 (PDT) X-Received: by 10.36.98.136 with SMTP id d130mr15296619itc.84.1466414920038; Mon, 20 Jun 2016 02:28:40 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id q2si26496881pfq.194.2016.06.20.02.28.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 02:28:40 -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.80.1 #2 (Red Hat Linux)) id 1bEvUb-0003qR-B1; Mon, 20 Jun 2016 09:27:41 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bEvUU-0003fq-V0 for linux-arm-kernel@lists.infradead.org; Mon, 20 Jun 2016 09:27:35 +0000 Received: by mail-wm0-x231.google.com with SMTP id r201so52622417wme.1 for ; Mon, 20 Jun 2016 02:27:14 -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=p3S8e5j25XtcoA3WzYcNsei9/39paUlH4FVsd6AnKQE=; b=SSLX82+t1HudTnSoZv/bUT2Ouk1ztrQHLi8hSJphlDeUisjHXi97tDJCWg0Yg9tVLu hj3X9fu699T+aGOzJ5Ys9TXzAp2BGIEGBMh3LaEP+L78h/fJJm6reNNoKXd+KorC3t0f yxNaB233zVjBPT9wexx/jIADnJHcd9NRKWGgs= 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=p3S8e5j25XtcoA3WzYcNsei9/39paUlH4FVsd6AnKQE=; b=CmMb1B7NSTcaNozZowoWfG+3WceWJScV5CYP91w02mHFvxoMhjQKgjmd+O/8z5G2Oj bq9QgMe7fZwqAVVqxVFKc2RwB2vocYr88RGe635VZuWsBx9J5JevUEtpeRw0cwvHgkV1 ELg8fqHnwPb3crmPdvMdRxzQOMbbNp5ADuKV0Ns4lbeOOK2DRh/Z+ucqAQcHnTFCihdU 5dd1uqkZ3UxHPSAzGAgU7EqquQh3dBCH74tjJuAiwd4iIzKIsUYBqXGhvZis1yOBCybM G8zwDfnasxqS6q2JwO5uv9FwSE8QkSmYpxPEs+XD2C9kikF3KxsyYo3r8E103oWR0EhL nAZA== X-Gm-Message-State: ALyK8tLElYW8MLnQ+LjbBllDqeLrOeuKq4hwUgKISu5iUWRB8tG7kmEwiEnyFiek5HPoWgCr X-Received: by 10.28.31.140 with SMTP id f134mr9704998wmf.69.1466414833372; Mon, 20 Jun 2016 02:27:13 -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 u4sm62555725wjz.4.2016.06.20.02.27.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Jun 2016 02:27:12 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de, liviu.dudau@arm.com Subject: [PATCH V3] clocksource/drivers/mps2-timer: Convert init function to return error Date: Mon, 20 Jun 2016 11:26:59 +0200 Message-Id: <1466414820-19574-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <20160620091506.GO9711@e106497-lin.cambridge.arm.com> References: <20160620091506.GO9711@e106497-lin.cambridge.arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160620_022735_149653_49591B04 X-CRM114-Status: GOOD ( 14.51 ) 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The init functions do not return any error. They behave as the following: - panic, thus leading to a kernel crash while another timer may work and make the system boot up correctly or - print an error and let 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/mps2-timer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/clocksource/mps2-timer.c b/drivers/clocksource/mps2-timer.c index 3d33a5e..c303fa9 100644 --- a/drivers/clocksource/mps2-timer.c +++ b/drivers/clocksource/mps2-timer.c @@ -250,7 +250,7 @@ out: return ret; } -static void __init mps2_timer_init(struct device_node *np) +static int __init mps2_timer_init(struct device_node *np) { static int has_clocksource, has_clockevent; int ret; @@ -259,7 +259,7 @@ static void __init mps2_timer_init(struct device_node *np) ret = mps2_clocksource_init(np); if (!ret) { has_clocksource = 1; - return; + return 0; } } @@ -267,9 +267,11 @@ static void __init mps2_timer_init(struct device_node *np) ret = mps2_clockevent_init(np); if (!ret) { has_clockevent = 1; - return; + return 0; } } + + return 0; } -CLOCKSOURCE_OF_DECLARE(mps2_timer, "arm,mps2-timer", mps2_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(mps2_timer, "arm,mps2-timer", mps2_timer_init);