lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1525159407-31708-2-git-send-email-tali.perry1@gmail.com>
Date:   Tue,  1 May 2018 10:23:27 +0300
From:   Tali Perry <tali.perry1@...il.com>
To:     sboyd@...nel.org, brendanhiggins@...gle.com, robh+dt@...nel.org,
        mark.rutland@....com, linux@...linux.org.uk,
        weiyongjunl@...wei.com, avifishman70@...il.com,
        tmaimon77@...il.com, raltherr@...gle.com
Cc:     devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, openbmc@...ts.ozlabs.org,
        Tali Perry <tali.perry1@...il.com>,
        Wei Yongjun <weiyongjun1@...wei.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


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@...il.com>
Reviewed-by: Rob Herring <robh@...nel.org>
Signed-off-by: Wei Yongjun <weiyongjun1@...wei.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ