An amplifier regulator property should be an option according to the binding document but currently it's not so this commit makes the amplifier regulator property as an option actually for cases that don't have the actual amplifier H/W. Fixes: 9e5492443278 ("Input: pwm-beeper - add optional amplifier regulator") Cc: David Lechner <david@xxxxxxxxxxxxxx> Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@xxxxxxxxxxxxxxx> --- drivers/input/misc/pwm-beeper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index edca0d737750..a3baa52f187f 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -52,7 +52,7 @@ static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period) if (error) return error; - if (!beeper->amplifier_on) { + if (beeper->amplifier && !beeper->amplifier_on) { error = regulator_enable(beeper->amplifier); if (error) { pwm_disable(beeper->pwm); @@ -67,7 +67,7 @@ static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period) static void pwm_beeper_off(struct pwm_beeper *beeper) { - if (beeper->amplifier_on) { + if (beeper->amplifier && beeper->amplifier_on) { regulator_disable(beeper->amplifier); beeper->amplifier_on = false; } @@ -163,9 +163,9 @@ static int pwm_beeper_probe(struct platform_device *pdev) if (IS_ERR(beeper->amplifier)) { error = PTR_ERR(beeper->amplifier); if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to get 'amp' regulator: %d\n", + dev_dbg(dev, "Failed to get 'amp' regulator: %d\n", error); - return error; + beeper->amplifier = NULL; } INIT_WORK(&beeper->work, pwm_beeper_work); -- 2.21.0