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]
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 04/12] regulator/core: regulator_bulk_get: remove redundant
 NULL stores

On error, callers of regulator_bulk_get() pass the error up and don't
use the pointers in consumers[]. The function is documented to release
all regulators if any request fails.

Note: if an i-th regulator_get() failed only the i-th pointer was
cleared. This is another suggestion that the clearing was unnecessary.

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

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 3d7147fabbed..a1573a7ff2b2 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4872,11 +4872,7 @@ static int _notifier_call_chain(struct regulator_dev *rdev,
 int _regulator_bulk_get(struct device *dev, int num_consumers,
 			struct regulator_bulk_data *consumers, enum regulator_get_type get_type)
 {
-	int i;
-	int ret;
-
-	for (i = 0; i < num_consumers; i++)
-		consumers[i].consumer = NULL;
+	int ret, i;
 
 	for (i = 0; i < num_consumers; i++) {
 		consumers[i].consumer = _regulator_get(dev,
@@ -4885,7 +4881,6 @@ int _regulator_bulk_get(struct device *dev, int num_consumers,
 			ret = dev_err_probe(dev, PTR_ERR(consumers[i].consumer),
 					    "Failed to get supply '%s'",
 					    consumers[i].supply);
-			consumers[i].consumer = NULL;
 			goto err;
 		}
 
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ