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: <20210602084259.1267768-1-yukuai3@huawei.com>
Date:   Wed, 2 Jun 2021 16:42:59 +0800
From:   Yu Kuai <yukuai3@...wei.com>
To:     <dinguyen@...nel.org>, <mturquette@...libre.com>,
        <sboyd@...nel.org>
CC:     <linux-clk@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <yukuai3@...wei.com>, <yi.zhang@...wei.com>
Subject: [PATCH V2] clk: socfpga: err out if of_clk_add_provider() failed in __socfpga_pll_init()

__socfpga_pll_init() should fail if of_clk_add_provider() failed.
remove 'rc' in the meantime to avoid gcc
'-Wunused-but-set-variable' warning.

Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
changes in V2:
 - remove 'rc' and use err' instead of 'rc'
 - err out if of_clk_add_provider() failed

 drivers/clk/socfpga/clk-pll.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c
index dcb573d44034..5a9eec2eca80 100644
--- a/drivers/clk/socfpga/clk-pll.c
+++ b/drivers/clk/socfpga/clk-pll.c
@@ -80,7 +80,6 @@ static __init struct clk_hw *__socfpga_pll_init(struct device_node *node,
 	const char *parent_name[SOCFPGA_MAX_PARENTS];
 	struct clk_init_data init;
 	struct device_node *clkmgr_np;
-	int rc;
 	int err;
 
 	of_property_read_u32(node, "reg", &reg);
@@ -110,12 +109,16 @@ static __init struct clk_hw *__socfpga_pll_init(struct device_node *node,
 	hw_clk = &pll_clk->hw.hw;
 
 	err = clk_hw_register(NULL, hw_clk);
-	if (err) {
-		kfree(pll_clk);
-		return ERR_PTR(err);
-	}
-	rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
+	if (err)
+		goto err_out;
+	err = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
+	if (err)
+		goto err_out;
 	return hw_clk;
+
+err_out:
+	kfree(pll_clk);
+	return ERR_PTR(err);
 }
 
 void __init socfpga_pll_init(struct device_node *node)
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ