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: <17f0bcb197b82e6a7bd8860178a363c96f85572d.1714399603.git.mirq-linux@rere.qmqm.pl>
Date: Mon, 29 Apr 2024 16:45:27 +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 02/12] regulator/core: set_consumer_device_supply: remove
 `has_dev`

`has_dev` is only ever used once to check if the name is non-NULL.
Inline the check and make the intent obvious.

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

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 62dd3ac19e6d..5db3bf08145c 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1738,16 +1738,10 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
 				      const char *supply)
 {
 	struct regulator_map *node, *new_node;
-	int has_dev;
 
 	if (supply == NULL)
 		return -EINVAL;
 
-	if (consumer_dev_name != NULL)
-		has_dev = 1;
-	else
-		has_dev = 0;
-
 	new_node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL);
 	if (new_node == NULL)
 		return -ENOMEM;
@@ -1755,7 +1749,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
 	new_node->regulator = rdev;
 	new_node->supply = supply;
 
-	if (has_dev) {
+	if (consumer_dev_name != NULL) {
 		new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL);
 		if (new_node->dev_name == NULL) {
 			kfree(new_node);
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ