From patchwork Tue Jul 26 12:31:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101986 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1661996qga; Tue, 26 Jul 2016 05:32:09 -0700 (PDT) X-Received: by 10.66.20.66 with SMTP id l2mr39140815pae.118.1469536329462; Tue, 26 Jul 2016 05:32:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u87si647516pfa.1.2016.07.26.05.32.09; Tue, 26 Jul 2016 05:32:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756667AbcGZMb7 (ORCPT + 29 others); Tue, 26 Jul 2016 08:31:59 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:58847 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756624AbcGZMb4 (ORCPT ); Tue, 26 Jul 2016 08:31:56 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0M73gb-1b4hwT2eU1-00wqOK; Tue, 26 Jul 2016 14:31:44 +0200 From: Arnd Bergmann To: Rich Felker Cc: Arnd Bergmann , Daniel Lezcano , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH] clocksource: j-core: type fix init function return code Date: Tue, 26 Jul 2016 14:31:29 +0200 Message-Id: <20160726123140.878340-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:NonmVTmkcC2wygAAlmeodEFspAgUgjsA8hyg7yjFVaGPIdwUnHM Ss9l8rnUGUSYNnNeMpgNk7TJJTKSoOdClqDJZ0IEvQzlT6IIrJNH5tRBasjtwKx4qEuIDsz XUZcC8LysftAzDhcJxXrx+JyT4d1KfZTF9JDZ1nZAugvUItvPPn483vxIFf3pY949EYrBLT fOlcWwsKtzgvNi5p562BA== X-UI-Out-Filterresults: notjunk:1; V01:K0:DLlHBQ40PE8=:66AvfMusFpwXA/FkNN/9Xm kvLkL9VIm8BY4XekRwJ4CyODFfJfUqnm0q9gASTm5QHCLNAQfy8MhecLAQiFlRtCXKgK92e2P Lgbnx5YaFaTegzUsk4WaQ7q2PFTh+cjfTEQ8PM63Kl2Z5th1CExoCTNreizBIS6Lumk9MtMhP TZP/y3LFowYgzgnXwom/PCdF6y5ZyOV3QiyOQCq2TRfO08+hrsa6qK+7p3J2wU+2MN48C5vr3 rvY9UGmVskGnumRwj98jbGn5xBS4fw+sfNFG/ilNMu6qnPZavybmXSsvbrOzz4Hv0Xh44m8zC jh/HF5kAb9NkhlQHf9fuHCjVT2Zu5d4BkszLxzmLh3EAJ8yZa6VPA31cPC6Ct1mc36B8LkRyW 3eB2YL4LMmBSXVjreNhvHfwG3yef4UtVApXS6YLallL0HK4j6Rgp3/vJ6h0lodKt1OSFUuV6P V4oEgr6LcEJAVdUhNE0l7VuiBuNlm/jPrRwU1U52gpBFo3iBV7MRTu8rXvFgqaWJVNUYGvczJ z/nZL0dKkm+rEbNa8WUR6BSXnzDf7DJm/m01LmBy4lZBRCr+lgvx+W8jvb8nk4KqcY/amQT3f PB+uMiYvTfTQgQ+Ay7+DvysDZnBg8FrO9kzODEObtI53Xw7b9tBaUN7ULTlsFIeiJRETqaFZe DI1ul6qENlyZ9MZ7bPT0Id9M0zyv5n6bbiTAO0qKYqOM9BWubvQvlVYcCcUwYmjXrNjE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The CLOCKSOURCE_OF_DECLARE now takes a function that returns an 'int', but a this new clocksource driver has just appeared in linux-next and causes a warning because it has the old 'void' return value: In file included from ../include/linux/clocksource.h:18:0, from ../include/linux/clockchips.h:13, from ../drivers/clocksource/jcore-pit.c:14: include/linux/of.h:1006:20: error: comparison of distinct pointer types lacks a cast [-Werror] .data = (fn == (fn_type)NULL) ? fn : fn } ^ This adapts the jcore_pit_init() function to the correct return type. Signed-off-by: Arnd Bergmann Fixes: e0aa0655c60b ("clocksource: add J-Core timer/clocksource driver") --- The patch that introduces the warnign currently only exists in the linux-sh git tree and showed up in linux-next this week. --- drivers/clocksource/jcore-pit.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/drivers/clocksource/jcore-pit.c b/drivers/clocksource/jcore-pit.c index 373b9f954a5c..4a2f7803624b 100644 --- a/drivers/clocksource/jcore-pit.c +++ b/drivers/clocksource/jcore-pit.c @@ -154,7 +154,7 @@ static irqreturn_t jcore_timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static void __init jcore_pit_init(struct device_node *node) +static int __init jcore_pit_init(struct device_node *node) { int err; __iomem void *pit_base; @@ -169,12 +169,14 @@ static void __init jcore_pit_init(struct device_node *node) pit_base = of_iomap(node, 0); if (!pit_base) { pr_err("Error: Cannot map base address for J-Core PIT\n"); + err = -ENXIO; goto out; } pit_irq = irq_of_parse_and_map(node, 0); if (!pit_irq) { pr_err("Error: J-Core PIT has no IRQ\n"); + err = -ENXIO; goto out; } @@ -183,6 +185,7 @@ static void __init jcore_pit_init(struct device_node *node) cs = kzalloc(sizeof *cs, GFP_KERNEL); if (!cs) { pr_err("Failed to allocate memory for clocksource\n"); + err = ENOMEM; goto out; } jcore_cs = &cs->cs; @@ -207,12 +210,14 @@ static void __init jcore_pit_init(struct device_node *node) pit_percpu = alloc_percpu(struct jcore_pit); if (!pit_percpu) { pr_err("Failed to allocate memory for clock event device\n"); + err = ENOMEM; goto out; } nb = kzalloc(sizeof *nb, GFP_KERNEL); if (!nb) { pr_err("Failed to allocate memory for J-Core PIT notifier\n"); + err = ENOMEM; goto out; } @@ -268,10 +273,11 @@ static void __init jcore_pit_init(struct device_node *node) jcore_pit_local_init(this_cpu_ptr(pit_percpu)); - return; + return 0; out: pr_err("Could not initialize J-Core PIT driver\n"); + return err; } CLOCKSOURCE_OF_DECLARE(jcore_pit, "jcore,pit", jcore_pit_init);