From patchwork Thu Jul 7 08:01:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71561 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1282327qgy; Thu, 7 Jul 2016 01:32:22 -0700 (PDT) X-Received: by 10.66.167.16 with SMTP id zk16mr34306599pab.146.1467880342788; Thu, 07 Jul 2016 01:32:22 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 90si3081283pfr.48.2016.07.07.01.32.22; Thu, 07 Jul 2016 01:32:22 -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 S933444AbcGGIcU (ORCPT + 30 others); Thu, 7 Jul 2016 04:32:20 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35157 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933366AbcGGIDT (ORCPT ); Thu, 7 Jul 2016 04:03:19 -0400 Received: by mail-wm0-f41.google.com with SMTP id z126so138045639wme.0 for ; Thu, 07 Jul 2016 01:03:18 -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=6SVzV1d1cH/ei+mX1otd3tc01omCYuNk5RWEg7B3G0s=; b=MdyXlF2NjoticDlQl1XpexQxwzERRym68fpI/yUVLl/Pms/PJaKM9HrfJre55oZas+ YQi1eu7EU5HoBoVosIgYE1oZhhn+pDD+voto3MrOLPkaBLs9CI/BMPg7ZX7yO4tdtoTN DgtKg1LXgl9E1mc8NVGT8fXQl/FLmBxwiDZBU= 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=6SVzV1d1cH/ei+mX1otd3tc01omCYuNk5RWEg7B3G0s=; b=dOeWfWwRl3ovus5cqx0VBIdmrQU8sV9IofTqvgS2IyOcRYoM7tRyyTsiMb/rcXkOLN ScXyLovIACAfisgrUXMHUyC9riwqFIiTq5g4PICYbR3o+caVZSvjxfH95CrRXR+HeKxK lgbVman4pFbky545nrGi9W/E7BdEmXCxIrpjuKKXRdzQrwt4MwEccuNhnPe+yCJYZh9D 3/AxMfa9KQm1bMJQbNXioqOrDh6IX0EI//zaWi6vVo9Ndii9zHV7io8m7JcZl9Zkwur0 g2k3xY3pkz8AUUkjE5lZ4BBseztbiJvEDYdZOLZTyOzDZwfQAkIINSIVKsOTn/lEZp1m OR7w== X-Gm-Message-State: ALyK8tIOf4lrCbaCGESKap39OL2K8HhOqJ5A/WqIFOFwr7vP1L+PXO33rf0HethXXqxNFXAv X-Received: by 10.194.88.106 with SMTP id bf10mr27796089wjb.37.1467878598201; Thu, 07 Jul 2016 01:03:18 -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.03.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 01:03:17 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, daniel.lezcano@linaro.org Cc: linux-kernel@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp Subject: [PATCH 31/93] clocksource/drivers/h8300_tpu: Convert init function to return error Date: Thu, 7 Jul 2016 10:01:04 +0200 Message-Id: <1467878526-1238-31-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/h8300_tpu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 1.9.1 diff --git a/drivers/clocksource/h8300_tpu.c b/drivers/clocksource/h8300_tpu.c index d4c1a28..4faf718 100644 --- a/drivers/clocksource/h8300_tpu.c +++ b/drivers/clocksource/h8300_tpu.c @@ -119,15 +119,16 @@ static struct tpu_priv tpu_priv = { #define CH_L 0 #define CH_H 1 -static void __init h8300_tpu_init(struct device_node *node) +static int __init h8300_tpu_init(struct device_node *node) { void __iomem *base[2]; struct clk *clk; + int ret = -ENXIO; clk = of_clk_get(node, 0); if (IS_ERR(clk)) { pr_err("failed to get clock for clocksource\n"); - return; + return PTR_ERR(clk); } base[CH_L] = of_iomap(node, CH_L); @@ -144,14 +145,13 @@ static void __init h8300_tpu_init(struct device_node *node) tpu_priv.mapbase1 = base[CH_L]; tpu_priv.mapbase2 = base[CH_H]; - clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64); - - return; + return clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64); unmap_L: iounmap(base[CH_H]); free_clk: clk_put(clk); + return ret; } -CLOCKSOURCE_OF_DECLARE(h8300_tpu, "renesas,tpu", h8300_tpu_init); +CLOCKSOURCE_OF_DECLARE_RET(h8300_tpu, "renesas,tpu", h8300_tpu_init);