summaryrefslogtreecommitdiff
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-04-16 18:44:23 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-16 19:55:08 +0100
commit854ccbaee7e48734936690a3fd4817c57e98aaad (patch)
tree84c723a0ca25092e6a0c8d21ca96ea9975c3ff5b /drivers/regulator/core.c
parent8ac0e95d6467ced054565312ecdf0a55a5333c64 (diff)
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 <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5c0c975e5ac2..2f0d557a910d 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2335,6 +2335,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) {