From: Tali Perry <tali.perry1@gmail.com>
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
Cc: devicetree@vger.kernel.org, openbmc@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Tali Perry <tali.perry1@gmail.com>,
Wei Yongjun <weiyongjun1@huawei.com>,
linux-arm-kernel@lists.infradead.org
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 [thread overview]
Message-ID: <1525159407-31708-2-git-send-email-tali.perry1@gmail.com> (raw)
In-Reply-To: <1525159407-31708-1-git-send-email-tali.perry1@gmail.com>
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 <tali.perry1@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
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);
--
2.14.1
next prev parent reply other threads:[~2018-05-01 7:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-01 7:23 [PATCH v1 0/1] clk: npcm750: fix base address and of_clk_get_by_name Tali Perry
2018-05-01 7:23 ` Tali Perry [this message]
2018-05-15 22:15 ` [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 Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1525159407-31708-2-git-send-email-tali.perry1@gmail.com \
--to=tali.perry1@gmail.com \
--cc=avifishman70@gmail.com \
--cc=brendanhiggins@google.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=openbmc@lists.ozlabs.org \
--cc=raltherr@google.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=tmaimon77@gmail.com \
--cc=weiyongjun1@huawei.com \
--cc=weiyongjunl@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).