提交 23c3f310 编写于 作者: C Charles Keepax 提交者: Mark Brown

regulator: core: Correct return value check in regulator_resolve_supply

The ret pointer passed to regulator_dev_lookup is only filled with a
valid error code if regulator_dev_lookup returned NULL. Currently
regulator_resolve_supply checks this ret value before it checks if a
regulator was returned, this can result in valid regulator lookups being
ignored.

Fixes: 6261b06d ("regulator: Defer lookup of supply to regulator_get")
Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
上级 9f8df6ad
......@@ -1394,15 +1394,15 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
return 0;
r = regulator_dev_lookup(dev, rdev->supply_name, &ret);
if (ret == -ENODEV) {
/*
* No supply was specified for this regulator and
* there will never be one.
*/
return 0;
}
if (!r) {
if (ret == -ENODEV) {
/*
* No supply was specified for this regulator and
* there will never be one.
*/
return 0;
}
if (have_full_constraints()) {
r = dummy_regulator_rdev;
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册