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:   Wed, 30 Aug 2023 23:38:54 +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 2/9] 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 d440cd137c38..a467be1f198b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1726,16 +1726,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;
@@ -1743,7 +1737,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