mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
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 commitb8c3255457("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(). Fixes:b8c3255457("regulator: Move OF-specific regulator lookup code to of_regulator.c") Signed-off-by: Wei Fang <wei.fang@nxp.com> Link: https://patch.msgid.link/20240911120338.526384-1-wei.fang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
5faf6daf65
commit
a1d12410d9
1 changed files with 3 additions and 0 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue