From patchwork Tue Jun 28 10:31:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71020 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1511162qgy; Tue, 28 Jun 2016 03:38:09 -0700 (PDT) X-Received: by 10.98.67.7 with SMTP id q7mr542347pfa.150.1467110289566; Tue, 28 Jun 2016 03:38:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k126si33095806pfc.180.2016.06.28.03.38.09; Tue, 28 Jun 2016 03:38: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; 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 S1753076AbcF1Kh5 (ORCPT + 30 others); Tue, 28 Jun 2016 06:37:57 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:35630 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752974AbcF1Ke3 (ORCPT ); Tue, 28 Jun 2016 06:34:29 -0400 Received: by mail-wm0-f52.google.com with SMTP id v199so133630462wmv.0 for ; Tue, 28 Jun 2016 03:34:29 -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=62+V+FtrgDqz2jTwhqhFybSs8bf02jV04Ww8vyMQGZM=; b=R749o49wIJAXnNC8agr6p4Uid1prVvy3IfjeyhFG8tx8ISSAYARIat3ywcGSL2PTPO bPtuDj34BbWjY9kH8HW5uu4PTiIzuzdY3zmnTTUHW+3gEH4HH+KL2GNrDlXaIXrZaNQ5 rSbZIHLe7YoueyxFP1F+n1A29cJmmV7G7XqCs= 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=62+V+FtrgDqz2jTwhqhFybSs8bf02jV04Ww8vyMQGZM=; b=jEysao1OMRfTJyO2zUJGAOsQMli+ytRaR3x6QJuengbcm5xu4JRQdv2XVuy7Gh2zFu //XGlIdicKPtVMvNqNevr8yb2V1bP8VPiWp4NnB+KB4VZXpYs/XRmw37OM5SAQJj/Swl 3YrRXyVBwmKdPGlvAmM16YQvqH0CjfqzAu9KWYtXzGu83Wu3CqYJWGSeV9owW0EfnBvF 0ZnssFlYVevaZxjfjsQN+VwMQnYe0mACxKDzpLOU2UaDb0TOFgcALQROpKbKrwXGrzo9 MHVcXTSkMP2Ynl0SCfy2dIQnQa1MmgyVK6loJPNGzIGwQXDPeN49h5epUEdiNGYT8KDZ OyOQ== X-Gm-Message-State: ALyK8tLdxWyZaItvaesKsZ0xkYxDx3N+081jhrpni7NqctSuJ1nxGMiObJ5/NPRscXnWsEd4 X-Received: by 10.28.193.14 with SMTP id r14mr4490716wmf.94.1467110067879; Tue, 28 Jun 2016 03:34:27 -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.34.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 03:34:27 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, linux-mips@linux-mips.org Subject: [PATCH 66/92] clocksource/drivers/ralink: Convert init function to return error Date: Tue, 28 Jun 2016 12:31:25 +0200 Message-Id: <1467109911-11060-66-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 --- arch/mips/ralink/cevt-rt3352.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 1.9.1 diff --git a/arch/mips/ralink/cevt-rt3352.c b/arch/mips/ralink/cevt-rt3352.c index 3ad0b07..f2d3c79 100644 --- a/arch/mips/ralink/cevt-rt3352.c +++ b/arch/mips/ralink/cevt-rt3352.c @@ -117,11 +117,13 @@ static int systick_set_oneshot(struct clock_event_device *evt) return 0; } -static void __init ralink_systick_init(struct device_node *np) +static int __init ralink_systick_init(struct device_node *np) { + int ret; + systick.membase = of_iomap(np, 0); if (!systick.membase) - return; + return -ENXIO; systick_irqaction.name = np->name; systick.dev.name = np->name; @@ -131,16 +133,21 @@ static void __init ralink_systick_init(struct device_node *np) systick.dev.irq = irq_of_parse_and_map(np, 0); if (!systick.dev.irq) { pr_err("%s: request_irq failed", np->name); - return; + return -EINVAL; } - clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name, - SYSTICK_FREQ, 301, 16, clocksource_mmio_readl_up); + ret = clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name, + SYSTICK_FREQ, 301, 16, + clocksource_mmio_readl_up); + if (ret) + return ret; clockevents_register_device(&systick.dev); pr_info("%s: running - mult: %d, shift: %d\n", np->name, systick.dev.mult, systick.dev.shift); + + return 0; } -CLOCKSOURCE_OF_DECLARE(systick, "ralink,cevt-systick", ralink_systick_init); +CLOCKSOURCE_OF_DECLARE_RET(systick, "ralink,cevt-systick", ralink_systick_init);