From patchwork Thu Jul 7 08:00: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: 71505 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1271100qgy; Thu, 7 Jul 2016 01:03:14 -0700 (PDT) X-Received: by 10.66.236.133 with SMTP id uu5mr49335517pac.35.1467878594225; Thu, 07 Jul 2016 01:03:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ud9si663704pac.210.2016.07.07.01.03.13; Thu, 07 Jul 2016 01:03:14 -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 S1030270AbcGGIDB (ORCPT + 30 others); Thu, 7 Jul 2016 04:03:01 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:34878 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933295AbcGGIC5 (ORCPT ); Thu, 7 Jul 2016 04:02:57 -0400 Received: by mail-wm0-f54.google.com with SMTP id z126so138033220wme.0 for ; Thu, 07 Jul 2016 01:02:56 -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=aXippU5RaiiC524q1ZXspIOYXICkhFqVuci7d562No2IPLCzyGXGo4XsdSlVXhmoih itUpCjnHakJkUn13A0vPr2a9vE1SgbuIiSxEM1TYW77xCX4tDg9iuZjqcDdGwE/mzvGz Hxg8JHNtBlc+OiR6qLBtEln2qXfDSqGGdPhWk= 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=XisfeYqQ0lCZP+V/xM3Kz6D2k5zyRh9kFHT2AGStLlnyJVFoPqg7bERU1CBf+bmegu j44R2CSbGE6wv9z7S+URLyRNFpJOpuH/5dVzd7JunOxPFQC5D29bOe8bGC2zOMIRbI+X CdatYfTCYj+A3IcNG6Xy62i6JkmkRjuuQH58WVjSBt4K95vMaOywwjCHMB3ZdiWfLkAf K/4hA68ULksdacuv8Hky7i4LPU0Xh6Nhb+FZnvCeUw+XBWNvLyNAgc7yLiIgIqwSSf/h 7tgb6tnYggndE/wI4uSP18rprrYryK9wFSElmGX9ioysBgkYma3T79LsEwc7KVPZ34O3 MgQg== X-Gm-Message-State: ALyK8tLf1QYBvoTec2nYWOtz5lVjlT+8luIwxvXria6Mt8xWyTepziUkKYr/Qy2xbqz4KuHl X-Received: by 10.28.128.140 with SMTP id b134mr1333193wmd.37.1467878575796; Thu, 07 Jul 2016 01:02:55 -0700 (PDT) Received: from localhost.localdomain (lft31-1-88-121-166-205.fbx.proxad.net. [88.121.166.205]) by smtp.gmail.com with ESMTPSA id v70sm51327wmf.18.2016.07.07.01.02.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 01:02:55 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, daniel.lezcano@linaro.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 19/93] clocksource/drivers/dw_apb_timer: Convert init function to return error Date: Thu, 7 Jul 2016 10:00:52 +0200 Message-Id: <1467878526-1238-19-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467878526-1238-1-git-send-email-daniel.lezcano@linaro.org> References: <577E0BED.3020608@linaro.org> <1467878526-1238-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);