regulator: core: fix the broken behavior of regulator_dev_lookup()
PATCH 1/1 regulator: core: fix the broken behavior of regulator_dev_lookup()
The behavior of regulator_dev_lookup() for non-DT way has been broken since the commit b8c325545714 ("regulator: Move OF-specific regulator lookup code to of_regulator.c").
Before the commit, of_get_regulator() was used to get the regulator, which returns NULL if the regulator is not found. So the regulator will be looked up through regulator_lookup_by_name() if no matching regulator is found in regulator_map_list.
However, currently, of_regulator_dev_lookup() is used to instead of of_get_regulator(), but the variable 'r' is set to ERR_PTR(-ENODEV) instead of NULL if the regulator is not found. In this case, if no regulator is found in regulator_map_list, the variable 'r' is still ERR_PTR(-ENODEV), So regulator_dev_lookup() returns the value of 'r' directly instead of continuing to look up the regulator through regulator_lookup_by_name().
--- drivers/regulator/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/regulator/core.c +3 -0
@@ -1965,6 +1965,9 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,return r;if (PTR_ERR (r) == -EPROBE_DEFER )return r; + +if (PTR_ERR (r) == -ENODEV ) + r =NULL ; }/* if not found, try doing it non-dt way */
Signature · 1 line
2.34.1
Mark Brown
maintainerQuoted 10 lines · Wei Fang
The behavior of
regulator_dev_lookup()for non-DT way has been broken since the commitb8c325545714("regulator: Move OF-specific regulator lookup code toof_regulator.c").Before the commit,
of_get_regulator()was used to get the regulator, which returns NULL if the regulator is not found. So the regulator will be looked up throughregulator_lookup_by_name()if no matching regulator is found inregulator_map_list.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: core: fix the broken behavior of regulator_dev_lookup()
commit: a1d12410d9b1ecff87d39f80b0d1cec895012ffa
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