Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1573648

Applied "regulator: core: remove dead code in _regulator_get()" to the regulator tree

From Mark Brown <broonie@kernel.org>
Newsgroups linux.kernel
Subject Applied "regulator: core: remove dead code in _regulator_get()" to the regulator tree
Date 2017-02-04 11:50 +0100
Message-ID <t764O-7Fv-11@gated-at.bofh.it> (permalink)
References <t6U3D-7uQ-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The patch

   regulator: core: remove dead code in _regulator_get()

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 7d245afa24b3ed911f6fd90079d70932ac5e5923 Mon Sep 17 00:00:00 2001
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: Fri, 3 Feb 2017 13:56:00 -0800
Subject: [PATCH] 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>
---
 drivers/regulator/core.c | 8 ++------
 1 file 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,
 					bool exclusive, bool allow_dummy)
 {
 	struct regulator_dev *rdev;
-	struct regulator *regulator = ERR_PTR(-EPROBE_DEFER);
+	struct regulator *regulator;
 	const char *devname = NULL;
 	int ret;
 
@@ -1596,11 +1596,6 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
 	if (dev)
 		devname = dev_name(dev);
 
-	if (have_full_constraints())
-		ret = -ENODEV;
-	else
-		ret = -EPROBE_DEFER;
-
 	rdev = regulator_dev_lookup(dev, id, &ret);
 	if (rdev)
 		goto found;
@@ -1656,6 +1651,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
 	}
 
 	if (!try_module_get(rdev->owner)) {
+		regulator = ERR_PTR(-EPROBE_DEFER);
 		put_device(&rdev->dev);
 		return regulator;
 	}
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] regulator: core: remove dead code in _regulator_get() Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 23:00 +0100
  [PATCH 5/5] regulator: core: lower severity level of message about using dummy supplies Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 23:00 +0100
    Re: [PATCH 5/5] regulator: core: lower severity level of message  about using dummy supplies Mark Brown <broonie@kernel.org> - 2017-02-04 12:50 +0100
      Re: [PATCH 5/5] regulator: core: lower severity level of message  about using dummy supplies Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-04 18:50 +0100
        Re: [PATCH 5/5] regulator: core: lower severity level of message  about using dummy supplies Mark Brown <broonie@kernel.org> - 2017-02-05 17:20 +0100
          Re: [PATCH 5/5] regulator: core: lower severity level of message  about using dummy supplies Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-07 02:00 +0100
            Re: [PATCH 5/5] regulator: core: lower severity level of message  about using dummy supplies Mark Brown <broonie@kernel.org> - 2017-02-08 19:20 +0100
  [PATCH 3/5] regulator: core: have _regulator_get() accept get_type argument Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 23:00 +0100
    Applied "regulator: core: have _regulator_get() accept get_type argument" to the regulator tree Mark Brown <broonie@kernel.org> - 2017-02-04 11:50 +0100
  Applied "regulator: core: remove dead code in _regulator_get()" to the regulator tree Mark Brown <broonie@kernel.org> - 2017-02-04 11:50 +0100

csiph-web