lkml.org 
[lkml]   [2024]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH v2 02/12] regulator/core: set_consumer_device_supply: remove `has_dev`
From
`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@rere.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

\
 
 \ /
  Last update: 2024-05-27 18:08    [W:0.076 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site