From: Axel Lin Date: Wed, 27 Jun 2018 12:40:14 +0000 (+0800) Subject: regulator: bd71837: Simplify bd71837_set_voltage_sel_restricted implementation X-Git-Tag: v4.19-rc1~164^2^2~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ffdc4984100050d0c8e2f11f76a15ca36f5d9e37;p=thirdparty%2Fkernel%2Flinux.git regulator: bd71837: Simplify bd71837_set_voltage_sel_restricted implementation Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/bd71837-regulator.c b/drivers/regulator/bd71837-regulator.c index 403b45de12626..f57f42ed71607 100644 --- a/drivers/regulator/bd71837-regulator.c +++ b/drivers/regulator/bd71837-regulator.c @@ -73,14 +73,10 @@ static int bd71837_buck1234_set_ramp_delay(struct regulator_dev *rdev, static int bd71837_set_voltage_sel_restricted(struct regulator_dev *rdev, unsigned int sel) { - int ret; - - ret = regulator_is_enabled_regmap(rdev); - if (!ret) - ret = regulator_set_voltage_sel_regmap(rdev, sel); - else if (ret == 1) - ret = -EBUSY; - return ret; + if (regulator_is_enabled_regmap(rdev)) + return -EBUSY; + + return regulator_set_voltage_sel_regmap(rdev, sel); } static struct regulator_ops bd71837_ldo_regulator_ops = {