Messages in this thread Patch in this message | | | Date | Sun, 20 Aug 2023 00:46:10 +0200 | Subject | [PATCH 4/6] regulator: core: remove `goto`s from resolve_supply() | From | Michał Mirosław <> |
| |
Since 14a71d509ac8 ("Fix lockdep warning resolving supplies") the `out` label is just `return ret;`. Inline it for easier reading.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- drivers/regulator/core.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 87e54b776a0f..de434d550937 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2053,11 +2053,9 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) r = regulator_dev_lookup(dev, rdev->supply_name); if (IS_ERR(r)) { - ret = PTR_ERR(r); - /* Did the lookup explicitly defer for us? */ - if (ret == -EPROBE_DEFER) - goto out; + if (PTR_ERR(r) == -EPROBE_DEFER) + return -EPROBE_DEFER; if (have_full_constraints()) { r = dummy_regulator_rdev; @@ -2065,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); } @@ -2090,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; } } @@ -2099,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; } /* @@ -2113,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); @@ -2135,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
| |