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: <079287cf3922f3b38a4f751f6e9097816037dd8e.1714399603.git.mirq-linux@rere.qmqm.pl>
Date: Mon, 29 Apr 2024 16:45:28 +0200
From:	Michał Mirosław <mirq-linux@...e.qmqm.pl>
To:	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH v2 03/12] regulator/core: of_get_child_regulator: remove goto

Because of_node_put() handles NULL properly (like kfree() et al)
we can call it also after the loop ends (due to child == NULL).
This makes the gotos redundant.

Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
---
 drivers/regulator/core.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5db3bf08145c..3d7147fabbed 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -438,18 +438,15 @@ static struct device_node *of_get_child_regulator(struct device_node *parent,
 
 	for_each_child_of_node(parent, child) {
 		regnode = of_parse_phandle(child, prop_name, 0);
+		if (regnode)
+			break;
 
-		if (!regnode) {
-			regnode = of_get_child_regulator(child, prop_name);
-			if (regnode)
-				goto err_node_put;
-		} else {
-			goto err_node_put;
-		}
+		regnode = of_get_child_regulator(child, prop_name);
+		if (regnode)
+			break;
 	}
-	return NULL;
 
-err_node_put:
+	/* Release the node if the loop was exited early. */
 	of_node_put(child);
 	return regnode;
 }
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ