[PATCH v2 4/7] regulator/core: regulator_resolve_supply: remove gotos

From: Michał Mirosław
Date: Wed Aug 30 2023 - 15:30:50 EST


Since 14a71d509ac8 ("Fix lockdep warning resolving supplies") the `out`
label is just `return ret;`. Inline it for easier reading.

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
---
drivers/regulator/core.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f18e7cb88a0d..e89c12d27a9d 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2039,7 +2039,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
struct regulator_dev *r;
struct device *dev = rdev->dev.parent;
struct ww_acquire_ctx ww_ctx;
- int ret = 0;
+ int ret;

/* No supply to resolve? */
if (!rdev->supply_name)
@@ -2055,7 +2055,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)

/* Did the lookup explicitly defer for us? */
if (ret == -EPROBE_DEFER)
- goto out;
+ return ret;

if (have_full_constraints()) {
r = dummy_regulator_rdev;
@@ -2063,18 +2063,15 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
} else {
dev_err(dev, "Failed to resolve %s-supply for %s\n",
rdev->supply_name, rdev->desc->name);
- ret = -EPROBE_DEFER;
- goto out;
+ return -EPROBE_DEFER;
}
}

if (r == rdev) {
dev_err(dev, "Supply for %s (%s) resolved to itself\n",
rdev->desc->name, rdev->supply_name);
- if (!have_full_constraints()) {
- ret = -EINVAL;
- goto out;
- }
+ if (!have_full_constraints())
+ return -EINVAL;
r = dummy_regulator_rdev;
get_device(&r->dev);
}
@@ -2088,8 +2085,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
if (r->dev.parent && r->dev.parent != rdev->dev.parent) {
if (!device_is_bound(r->dev.parent)) {
put_device(&r->dev);
- ret = -EPROBE_DEFER;
- goto out;
+ return -EPROBE_DEFER;
}
}

@@ -2097,7 +2093,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
ret = regulator_resolve_supply(r);
if (ret < 0) {
put_device(&r->dev);
- goto out;
+ return ret;
}

/*
@@ -2111,14 +2107,14 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
if (rdev->supply) {
regulator_unlock_two(rdev, r, &ww_ctx);
put_device(&r->dev);
- goto out;
+ return 0;
}

ret = set_supply(rdev, r);
if (ret < 0) {
regulator_unlock_two(rdev, r, &ww_ctx);
put_device(&r->dev);
- goto out;
+ return ret;
}

regulator_unlock_two(rdev, r, &ww_ctx);
@@ -2133,12 +2129,11 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
if (ret < 0) {
_regulator_put(rdev->supply);
rdev->supply = NULL;
- goto out;
+ return ret;
}
}

-out:
- return ret;
+ return 0;
}

/* Internal regulator request function */
--
2.39.2