lkml.org 
[lkml]   [2023]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH 4/9] regulator/core: regulator_bulk_get: remove redundant NULL stores
From
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@rere.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 3703aa3f5636..63d16fe59e84 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4829,11 +4829,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,
@@ -4842,7 +4838,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
\
 
 \ /
  Last update: 2023-08-31 00:58    [W:0.070 / U:1.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site