regulator: core: Add checking set_mode callback in regulator_set_optimum_mode
PATCH 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 | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/regulator/core.c +5 -0
@@ -2340,6 +2340,11 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)*/ ret = -EINVAL ; +if (!rdev->desc->ops->set_mode) { +rdev_err (rdev,"no set_mode operation\n" ); + goto out; + } +/* get output voltage */ output_uV =_regulator_get_voltage (rdev);if (output_uV <=0 ) {
Signature · 1 line
1.7.5.4
Quoted 5 lines · Axel Lin
drivers/regulator/core.c +0
-0
drivers/regulator/core.c int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) · line 2348
Quoted 9 lines
drivers/regulator/core.c +5
-0@@ -2340,6 +2340,11 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)*/ ret = -EINVAL ; +if (!rdev->desc->ops->set_mode) { +rdev_err (rdev,"no set_mode operation\n" ); + goto out; + } +/* get output voltage */
regulator_set_mode() just returns an error silently if there isn't a set_mode() op. Why print an error in this case?
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.