From patchwork Tue May 1 07:23:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tali Perry X-Patchwork-Id: 10373247 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 655516032A for ; Tue, 1 May 2018 08:14:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5783F28BF6 for ; Tue, 1 May 2018 08:14:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C28A28BFA; Tue, 1 May 2018 08:14:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DC3E128BF6 for ; Tue, 1 May 2018 08:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=9myJBzEa8HooIAp5XmTePC1VEHjpo3JQV9UK8eFaSL8=; b=GLafREpM/A+aFwCvAfOQiF4aqg Mqp1qkiwWTtLARB+Qv/M3f5U38fCf/PErWNXVB0HXFpVyPiyQt+dZmxxR4FRzJtsiozG/kachAOZk zmT9D+cvOU6yfNshIu750MpsVKLJSZKFwzsy/Pr/UXxAwfKiDnuITrzDPpVXTzRA4cT/YdtXzWbzC DH58nnFZo0kxymMFf3WfUYyIP5c5lGNR6wZT5cHQ8Ilf59/m2Qn7SzDEeuKlqbEElSqYXNnsvRrHk uHaSojjBDtfhxC1vCD4Br8U42SNl9bXAHdgl55vR+Ax0BwpdgWlTBU2zLU32WfroPbm1zQ+vKURh/ fKTLa5sw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fDQQn-0000XD-SO; Tue, 01 May 2018 08:14:37 +0000 Received: from 212.199.177.27.static.012.net.il ([212.199.177.27] helo=herzl.nuvoton.co.il) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fDQQj-0000SP-Jw for linux-arm-kernel@lists.infradead.org; Tue, 01 May 2018 08:14:35 +0000 Received: from talu34.nuvoton.co.il (ntil-fw [212.199.177.25]) by herzl.nuvoton.co.il (8.13.8/8.13.8) with ESMTP id w417OWD0001072; Tue, 1 May 2018 10:24:32 +0300 Received: by talu34.nuvoton.co.il (Postfix, from userid 20088) id 8BBA85AAB0; Tue, 1 May 2018 10:24:32 +0300 (IDT) From: Tali Perry To: sboyd@kernel.org, brendanhiggins@google.com, robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, weiyongjunl@huawei.com, avifishman70@gmail.com, tmaimon77@gmail.com, raltherr@google.com Subject: [PATCH v1 1/1] clk: npcm750: fix base address and of_clk_get_by_name error handling. Also update error messages to be more informative Date: Tue, 1 May 2018 10:23:27 +0300 Message-Id: <1525159407-31708-2-git-send-email-tali.perry1@gmail.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1525159407-31708-1-git-send-email-tali.perry1@gmail.com> References: <1525159407-31708-1-git-send-email-tali.perry1@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180501_011434_057457_6AA69CDC X-CRM114-Status: GOOD ( 10.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Tali Perry , Wei Yongjun , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Nuvoton NPCM7XX Clock Controller fix base address and of_clk_get_by_name error handling. Also update error messages to be more informative. In case clk_base allocation is erronoeous the return value is null. Also fix handling of of_clk_get_by_name returns an error. Print a better error message pointing to the dt-binding documention. Signed-off-by: Tali Perry Reviewed-by: Rob Herring Signed-off-by: Wei Yongjun Tali Perry (2): --- drivers/clk/clk-npcm7xx.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk-npcm7xx.c b/drivers/clk/clk-npcm7xx.c index 7e4964b9e5c8..6ff97f79fcd7 100644 --- a/drivers/clk/clk-npcm7xx.c +++ b/drivers/clk/clk-npcm7xx.c @@ -583,7 +583,7 @@ static void __init npcm7xx_clk_init(struct device_node *clk_np) clk_base = ioremap(res.start, resource_size(&res)); - if (IS_ERR(clk_base)) + if (!clk_base) goto npcm7xx_init_error; @@ -604,24 +604,27 @@ static void __init npcm7xx_clk_init(struct device_node *clk_np) /* Read fixed clocks. These 3 clocks must be defined in DT */ clk = of_clk_get_by_name(clk_np, NPCM7XX_CLK_S_REFCLK); - if (!IS_ERR(clk)) { - pr_err("failed to find external REFCLK: %ld\n", + if (IS_ERR(clk)) { + pr_err("failed to find external REFCLK on device tree, err=%ld\n", PTR_ERR(clk)); clk_put(clk); + goto npcm7xx_init_fail_no_clk_on_dt; } clk = of_clk_get_by_name(clk_np, NPCM7XX_CLK_S_SYSBYPCK); - if (!IS_ERR(clk)) { - pr_err("failed to find external SYSBYPCK: %ld\n", + if (IS_ERR(clk)) { + pr_err("failed to find external SYSBYPCK on device tree, err=%ld\n", PTR_ERR(clk)); clk_put(clk); + goto npcm7xx_init_fail_no_clk_on_dt; } clk = of_clk_get_by_name(clk_np, NPCM7XX_CLK_S_MCBYPCK); - if (!IS_ERR(clk)) { - pr_err("failed to find external MCBYPCK: %ld\n", + if (IS_ERR(clk)) { + pr_err("failed to find external MCBYPCK on device tree, err=%ld\n", PTR_ERR(clk)); clk_put(clk); + goto npcm7xx_init_fail_no_clk_on_dt; } /* Register plls */ @@ -705,6 +708,9 @@ static void __init npcm7xx_clk_init(struct device_node *clk_np) return; +npcm7xx_init_fail_no_clk_on_dt: + pr_err("see Documentation/devicetree/bindings/clock/" + "nuvoton,npcm750-clk.txt for details\n"); npcm7xx_init_fail: if (npcm7xx_clk_data->num) kfree(npcm7xx_clk_data->hws);