[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5fb938f4a07063fbca4893db2e6da1b63da87dc9.1693431144.git.mirq-linux@rere.qmqm.pl>
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