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>] [day] [month] [year] [list]
Message-ID: <79d31fe5-6ec1-4e40-be5f-85e1f61811c1@web.de>
Date: Tue, 17 Sep 2024 15:10:32 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-clk@...r.kernel.org, David Lechner <david@...hnology.com>,
 Michael Turquette <mturquette@...libre.com>,
 Nishka Dasgupta <nishkadg.linux@...il.com>, Stephen Boyd <sboyd@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] clk: davinci: Use common error handling code in
 of_davinci_pll_init()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 17 Sep 2024 15:00:53 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function implementation.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/clk/davinci/pll.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/davinci/pll.c b/drivers/clk/davinci/pll.c
index 5bbbb3a66477..eb79424f216d 100644
--- a/drivers/clk/davinci/pll.c
+++ b/drivers/clk/davinci/pll.c
@@ -777,16 +777,13 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
 		int i;

 		clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
-		if (!clk_data) {
-			of_node_put(child);
-			return -ENOMEM;
-		}
+		if (!clk_data)
+			goto put_node;

 		clks = kmalloc_array(n_clks, sizeof(*clks), GFP_KERNEL);
 		if (!clks) {
 			kfree(clk_data);
-			of_node_put(child);
-			return -ENOMEM;
+			goto put_node;
 		}

 		clk_data->clks = clks;
@@ -838,6 +835,10 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
 	of_node_put(child);

 	return 0;
+
+put_node:
+	of_node_put(child);
+	return -ENOMEM;
 }

 static struct davinci_pll_platform_data *davinci_pll_get_pdata(struct device *dev)
--
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ