diff options
Diffstat (limited to 'drivers/input/misc/max8997_haptic.c')
-rw-r--r-- | drivers/input/misc/max8997_haptic.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c index 1fea5484941f..a363ebbd9cc0 100644 --- a/drivers/input/misc/max8997_haptic.c +++ b/drivers/input/misc/max8997_haptic.c | |||
@@ -181,11 +181,21 @@ static void max8997_haptic_enable(struct max8997_haptic *chip) | |||
181 | } | 181 | } |
182 | 182 | ||
183 | if (!chip->enabled) { | 183 | if (!chip->enabled) { |
184 | chip->enabled = true; | 184 | error = regulator_enable(chip->regulator); |
185 | regulator_enable(chip->regulator); | 185 | if (error) { |
186 | dev_err(chip->dev, "Failed to enable regulator\n"); | ||
187 | goto out; | ||
188 | } | ||
186 | max8997_haptic_configure(chip); | 189 | max8997_haptic_configure(chip); |
187 | if (chip->mode == MAX8997_EXTERNAL_MODE) | 190 | if (chip->mode == MAX8997_EXTERNAL_MODE) { |
188 | pwm_enable(chip->pwm); | 191 | error = pwm_enable(chip->pwm); |
192 | if (error) { | ||
193 | dev_err(chip->dev, "Failed to enable PWM\n"); | ||
194 | regulator_disable(chip->regulator); | ||
195 | goto out; | ||
196 | } | ||
197 | } | ||
198 | chip->enabled = true; | ||
189 | } | 199 | } |
190 | 200 | ||
191 | out: | 201 | out: |