aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/pwm-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/pwm-regulator.c')
-rw-r--r--drivers/regulator/pwm-regulator.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index a79b5bcfec1d..c2b86eb97dd2 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -23,7 +23,6 @@
23struct pwm_regulator_data { 23struct pwm_regulator_data {
24 struct pwm_voltages *duty_cycle_table; 24 struct pwm_voltages *duty_cycle_table;
25 struct pwm_device *pwm; 25 struct pwm_device *pwm;
26 bool enabled;
27 int state; 26 int state;
28}; 27};
29 28
@@ -60,13 +59,10 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *dev,
60 59
61 drvdata->state = selector; 60 drvdata->state = selector;
62 61
63 if (!drvdata->enabled) { 62 ret = pwm_enable(drvdata->pwm);
64 ret = pwm_enable(drvdata->pwm); 63 if (ret) {
65 if (ret) { 64 dev_err(&dev->dev, "Failed to enable PWM\n");
66 dev_err(&dev->dev, "Failed to enable PWM\n"); 65 return ret;
67 return ret;
68 }
69 drvdata->enabled = true;
70 } 66 }
71 67
72 return 0; 68 return 0;