aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-02-03 16:56:00 -0500
committerMark Brown <broonie@kernel.org>2017-02-04 05:25:07 -0500
commit7d245afa24b3ed911f6fd90079d70932ac5e5923 (patch)
tree8327b3a5405b6757b0c3ed7f12d118394cef35a7
parentd00b74613fb18dfd0a5aa99270ee2e72d5c808d7 (diff)
regulator: core: remove dead code in _regulator_get()
There is no point in assigning value to 'ret' before calling regulator_dev_lookup() as it will clobber 'ret' anyway. Also, let's explicitly return -PROBE_DEFER when try_module_get() fails, instead of relying that earlier initialization of "regulator" carries correct value. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/regulator/core.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 04baac9a165b..b0ee068310c5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1584,7 +1584,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
1584 bool exclusive, bool allow_dummy) 1584 bool exclusive, bool allow_dummy)
1585{ 1585{
1586 struct regulator_dev *rdev; 1586 struct regulator_dev *rdev;
1587 struct regulator *regulator = ERR_PTR(-EPROBE_DEFER); 1587 struct regulator *regulator;
1588 const char *devname = NULL; 1588 const char *devname = NULL;
1589 int ret; 1589 int ret;
1590 1590
@@ -1596,11 +1596,6 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
1596 if (dev) 1596 if (dev)
1597 devname = dev_name(dev); 1597 devname = dev_name(dev);
1598 1598
1599 if (have_full_constraints())
1600 ret = -ENODEV;
1601 else
1602 ret = -EPROBE_DEFER;
1603
1604 rdev = regulator_dev_lookup(dev, id, &ret); 1599 rdev = regulator_dev_lookup(dev, id, &ret);
1605 if (rdev) 1600 if (rdev)
1606 goto found; 1601 goto found;
@@ -1656,6 +1651,7 @@ found:
1656 } 1651 }
1657 1652
1658 if (!try_module_get(rdev->owner)) { 1653 if (!try_module_get(rdev->owner)) {
1654 regulator = ERR_PTR(-EPROBE_DEFER);
1659 put_device(&rdev->dev); 1655 put_device(&rdev->dev);
1660 return regulator; 1656 return regulator;
1661 } 1657 }