mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 14:14:37 +00:00
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>
This commit is contained in:
parent
d00b74613f
commit
7d245afa24
1 changed files with 2 additions and 6 deletions
|
@ -1584,7 +1584,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
|
||||||
bool exclusive, bool allow_dummy)
|
bool exclusive, bool allow_dummy)
|
||||||
{
|
{
|
||||||
struct regulator_dev *rdev;
|
struct regulator_dev *rdev;
|
||||||
struct regulator *regulator = ERR_PTR(-EPROBE_DEFER);
|
struct regulator *regulator;
|
||||||
const char *devname = NULL;
|
const char *devname = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1596,11 +1596,6 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
|
||||||
if (dev)
|
if (dev)
|
||||||
devname = dev_name(dev);
|
devname = dev_name(dev);
|
||||||
|
|
||||||
if (have_full_constraints())
|
|
||||||
ret = -ENODEV;
|
|
||||||
else
|
|
||||||
ret = -EPROBE_DEFER;
|
|
||||||
|
|
||||||
rdev = regulator_dev_lookup(dev, id, &ret);
|
rdev = regulator_dev_lookup(dev, id, &ret);
|
||||||
if (rdev)
|
if (rdev)
|
||||||
goto found;
|
goto found;
|
||||||
|
@ -1656,6 +1651,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!try_module_get(rdev->owner)) {
|
if (!try_module_get(rdev->owner)) {
|
||||||
|
regulator = ERR_PTR(-EPROBE_DEFER);
|
||||||
put_device(&rdev->dev);
|
put_device(&rdev->dev);
|
||||||
return regulator;
|
return regulator;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue