From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] regulator: core: remove dead code in _regulator_get()
Date: Fri, 3 Feb 2017 13:56:00 -0800 [thread overview]
Message-ID: <20170203215604.23285-1-dmitry.torokhov@gmail.com> (raw)
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>
---
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.483.g087da7b7c-goog
next reply other threads:[~2017-02-03 21:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 21:56 Dmitry Torokhov [this message]
2017-02-03 21:56 ` [PATCH 2/5] regulator: core: have regulator_dev_lookup() return ERR_PTR-encoded errors Dmitry Torokhov
2017-02-04 10:11 ` Mark Brown
2017-02-04 18:19 ` [PATCH v2 " Dmitry Torokhov
2017-02-05 14:49 ` Mark Brown
2017-02-05 23:49 ` Mark Brown
2017-02-06 13:37 ` Applied "regulator: core: have regulator_dev_lookup() return ERR_PTR-encoded errors" to the regulator tree Mark Brown
2017-02-03 21:56 ` [PATCH 3/5] regulator: core: have _regulator_get() accept get_type argument Dmitry Torokhov
2017-02-04 10:48 ` Applied "regulator: core: have _regulator_get() accept get_type argument" to the regulator tree Mark Brown
2017-02-03 21:56 ` [PATCH 4/5] regulator: core: simplify _regulator_get() Dmitry Torokhov
2017-02-04 10:34 ` Mark Brown
2017-02-04 18:27 ` Dmitry Torokhov
2017-02-05 16:08 ` Mark Brown
2017-02-08 18:34 ` Applied "regulator: core: simplify _regulator_get()" to the regulator tree Mark Brown
2017-02-03 21:56 ` [PATCH 5/5] regulator: core: lower severity level of message about using dummy supplies Dmitry Torokhov
2017-02-04 11:48 ` Mark Brown
2017-02-04 17:45 ` Dmitry Torokhov
2017-02-05 16:12 ` Mark Brown
2017-02-07 0:56 ` Dmitry Torokhov
2017-02-08 18:19 ` Mark Brown
2017-02-04 10:48 ` Applied "regulator: core: remove dead code in _regulator_get()" to the regulator tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170203215604.23285-1-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).