regulator: core: Add checking set_mode callback in regulator_set_optimum_mode
PATCH v2 1/1 regulator: core: Add checking set_mode callback in regulator_set_optimum_mode
regulator_set_optimum_mode needs set_mode to properly work. Add checking for set_mode callback in case it may be not implemented.
Signed-off-by Axel Lin <[email protected]>
--- drivers/regulator/core.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/regulator/core.c +3 -0
@@ -2340,6 +2340,9 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)*/ ret = -EINVAL ; +if (!rdev->desc->ops->set_mode) + goto out; +/* get output voltage */ output_uV =_regulator_get_voltage (rdev);if (output_uV <=0 ) {
Signature · 1 line
1.7.5.4
Mark Brown
AppliedQuoted 2 lines · Axel Lin
regulator_set_optimum_modeneedsset_modeto properly work. Add checking forset_modecallback in case it may be not implemented.
Applied, thanks.