From patchwork Tue Jun 28 10:30:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71069 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1518763qgy; Tue, 28 Jun 2016 04:00:06 -0700 (PDT) X-Received: by 10.98.19.77 with SMTP id b74mr644570pfj.145.1467111606647; Tue, 28 Jun 2016 04:00:06 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sr7si1509351pab.10.2016.06.28.04.00.06; Tue, 28 Jun 2016 04:00:06 -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 S1752999AbcF1K7e (ORCPT + 30 others); Tue, 28 Jun 2016 06:59:34 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:35696 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752722AbcF1Kdc (ORCPT ); Tue, 28 Jun 2016 06:33:32 -0400 Received: by mail-wm0-f51.google.com with SMTP id v199so133588882wmv.0 for ; Tue, 28 Jun 2016 03:33:16 -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=XL03Tpb1qSWmHqbU922phEDLOBzGK72tjKmfyJXqINu44VqHv3McdubMRffDqLkqIR UfJdhjj6KCdVJc1wb9lgX8h7WsrHNry+oKRSXYSLKdZRyc2RaOWvKES7YPbuBC1u5Nsl C6lSIv6iSQufLs5CKzuU8+yE159SVqtn6nIO8= 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=Vr4LvQfq0ujMOM/ACNH+Dj3vFVwrkbUBr9Bix0tJUnDDAelo6ots9x5lBFW4EV6koe 1cPqTQB+UjM60J5b1iY2hlBJuh3Hi1Fj6k8obWai1Yi7gyOmrz3UjtNan5b6JDbmsy+o zAcJPqJr4TNVgK0eX+LRHivZiLny3TUq67glHeV8zGigmAY52erNxqUgTS+AO50+0d6r rjTRCr8/uq0vB6s32O78lHzSQokD8Mg6EXwfzru+9w8+QuObURGQqxKb8ywGlJIFyx3U HHMhBWZrjxQvxMtZOWcRfb4o1FTlRc/PiyTDgRu541P/Le1LCSCZqCL36Pkr+2TTAy+E 2BIw== X-Gm-Message-State: ALyK8tKJJTNCJODGKaVDG7QmDhhlYmMlrKn8yUmich1Lb+5hW3NzlMnEGFqwb8UbdODBoYpi X-Received: by 10.28.104.214 with SMTP id d205mr2885990wmc.102.1467109995618; Tue, 28 Jun 2016 03:33:15 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 03:33:15 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org Subject: [PATCH 19/92] clocksource/drivers/dw_apb_timer: Convert init function to return error Date: Tue, 28 Jun 2016 12:30:38 +0200 Message-Id: <1467109911-11060-19-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> 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);