Skip to content

Commit

Permalink
Input: max8997_haptic - add error handling for regulator and pwm
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sachin Kamat authored and Dmitry Torokhov committed Jun 8, 2014
1 parent fb4f8f5 commit b1bc303
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions drivers/input/misc/max8997_haptic.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,21 @@ static void max8997_haptic_enable(struct max8997_haptic *chip)
}

if (!chip->enabled) {
chip->enabled = true;
regulator_enable(chip->regulator);
error = regulator_enable(chip->regulator);
if (error) {
dev_err(chip->dev, "Failed to enable regulator\n");
goto out;
}
max8997_haptic_configure(chip);
if (chip->mode == MAX8997_EXTERNAL_MODE)
pwm_enable(chip->pwm);
if (chip->mode == MAX8997_EXTERNAL_MODE) {
error = pwm_enable(chip->pwm);
if (error) {
dev_err(chip->dev, "Failed to enable PWM\n");
regulator_disable(chip->regulator);
goto out;
}
}
chip->enabled = true;
}

out:
Expand Down

0 comments on commit b1bc303

Please sign in to comment.