Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1bc3031 authored by Sachin Kamat's avatar Sachin Kamat Committed by Dmitry Torokhov
Browse files

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: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent fb4f8f56
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -181,11 +181,21 @@ static void max8997_haptic_enable(struct max8997_haptic *chip)
	}
	}


	if (!chip->enabled) {
	if (!chip->enabled) {
		chip->enabled = true;
		error = regulator_enable(chip->regulator);
		regulator_enable(chip->regulator);
		if (error) {
			dev_err(chip->dev, "Failed to enable regulator\n");
			goto out;
		}
		max8997_haptic_configure(chip);
		max8997_haptic_configure(chip);
		if (chip->mode == MAX8997_EXTERNAL_MODE)
		if (chip->mode == MAX8997_EXTERNAL_MODE) {
			pwm_enable(chip->pwm);
			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:
out: