aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/max8997_haptic.c
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2014-06-08 02:10:25 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-06-08 02:20:24 -0400
commitb1bc3031e87f98f5f56f4f8fc23609371dbfa3bf (patch)
tree05cfee4e127538ddf1f892adf5d6278836681ac3 /drivers/input/misc/max8997_haptic.c
parentfb4f8f568a9def02240ef9bf7aabd246dc63a081 (diff)
Input: max8997_haptic - add error handling for regulator and pwm
Let's start checking return value of regulator_enable and pwm_enable to avoid errors. Fixes the following warning: drivers/input/misc/max8997_haptic.c:185:19: warning: ignoring return value of ‘regulator_enable’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc/max8997_haptic.c')
-rw-r--r--drivers/input/misc/max8997_haptic.c18
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
191out: 201out: