From patchwork Wed Jun 1 08:34:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 68991 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2409350qge; Wed, 1 Jun 2016 01:56:31 -0700 (PDT) X-Received: by 10.98.65.209 with SMTP id g78mr6442337pfd.163.1464771391670; Wed, 01 Jun 2016 01:56:31 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d25si49817809pfj.149.2016.06.01.01.56.31; Wed, 01 Jun 2016 01:56:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757799AbcFAIfs (ORCPT + 30 others); Wed, 1 Jun 2016 04:35:48 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:35768 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757377AbcFAIfp (ORCPT ); Wed, 1 Jun 2016 04:35:45 -0400 Received: by mail-wm0-f43.google.com with SMTP id a136so169902367wme.0 for ; Wed, 01 Jun 2016 01:35:44 -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=tuSw4M2QZ3aF9H6xSeunLzVjvaYmZSOhc+bQLtlpcIA=; b=D9CcrPAdqU2caJ7FmyoZ8L46L7CH0GWWDEkENpsLIj47i/fjcQWhV5NWBcOqB0dDYd Zh1Z13L3XRkzPAapGvf9FYugBIruRQC22PlidEOCMB0nplJpny9HD6hARkLc9d8YC/Bu mGwDO43gxBcKb0UbNfOLHMGxHBU8dsZ/Pycrs= 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=tuSw4M2QZ3aF9H6xSeunLzVjvaYmZSOhc+bQLtlpcIA=; b=hCjlZmqAN16YNFWmmxK/WXxrNNsA7/d4ifDYCev5eS9a9miLUGcMuH8tsTp2ddsHAn 7mEUrOW4HZfeBcqLHS8830fZLg08lwVtFIT6Rv+M0bDcPZmqj9rQVooC8cwXi3KcesgV VQ3CpsPZO/TBeWoZWFPxp5IL7eqtbGaTDLzdamdZ0urMX9KYucU6BqA2U3fZWQ82dlgC 6ocjKTYTWaYkGAOYF9ItP3/bWvcPz7THCdhphuY38m6SvvyrkggmQPeG2D6iPJvL0xfB TxG7e9Ne9zgZBRAz0jbvWVjpteo0ImjbIstlicLr8+bPuM+cE3pf15ZAEeEA63DTOBBY VHPQ== X-Gm-Message-State: ALyK8tJ1my3yQv2cBwdcoI7eJAro7nza6UCOySiPpG6Qb/2t5zAh9/6DsXsTtWj3MHCPcVLG X-Received: by 10.28.9.133 with SMTP id 127mr21205065wmj.2.1464770143580; Wed, 01 Jun 2016 01:35:43 -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 t3sm33542865wmf.20.2016.06.01.01.35.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jun 2016 01:35:43 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org Subject: [PATCH 9/9] clocksource/drivers/dw_apb_timer: Convert init function to return error Date: Wed, 1 Jun 2016 10:34:52 +0200 Message-Id: <1464770093-12667-10-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464770093-12667-1-git-send-email-daniel.lezcano@linaro.org> References: <1464770093-12667-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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/dw_apb_timer_of.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c index 860843c..4985a2c 100644 --- a/drivers/clocksource/dw_apb_timer_of.c +++ b/drivers/clocksource/dw_apb_timer_of.c @@ -143,7 +143,7 @@ static struct delay_timer dw_apb_delay_timer = { #endif static int num_called; -static void __init dw_apb_timer_init(struct device_node *timer) +static int __init dw_apb_timer_init(struct device_node *timer) { switch (num_called) { case 0: @@ -164,8 +164,10 @@ static void __init dw_apb_timer_init(struct device_node *timer) } num_called++; + + return 0; } -CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init); -CLOCKSOURCE_OF_DECLARE(apb_timer_osc, "snps,dw-apb-timer-osc", dw_apb_timer_init); -CLOCKSOURCE_OF_DECLARE(apb_timer_sp, "snps,dw-apb-timer-sp", dw_apb_timer_init); -CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer", dw_apb_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(apb_timer_osc, "snps,dw-apb-timer-osc", dw_apb_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(apb_timer_sp, "snps,dw-apb-timer-sp", dw_apb_timer_init); +CLOCKSOURCE_OF_DECLARE_RET(apb_timer, "snps,dw-apb-timer", dw_apb_timer_init);