Commit 947934e3 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: tps65219: Fix is_enabled checking in tps65219_set_bypass

Testing .enable cannot tell if a regulator is enabled or not, check return
value of .is_enabled() instead.
Also remove unneeded ret variable.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20220919122353.384171-1-axel.lin@ingics.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 21c93a95
...@@ -181,16 +181,14 @@ static int tps65219_set_bypass(struct regulator_dev *dev, bool enable) ...@@ -181,16 +181,14 @@ static int tps65219_set_bypass(struct regulator_dev *dev, bool enable)
{ {
struct tps65219 *tps = rdev_get_drvdata(dev); struct tps65219 *tps = rdev_get_drvdata(dev);
unsigned int rid = rdev_get_id(dev); unsigned int rid = rdev_get_id(dev);
int ret = 0;
if (dev->desc->ops->enable) { if (dev->desc->ops->is_enabled(dev)) {
dev_err(tps->dev, dev_err(tps->dev,
"%s LDO%d enabled, must be shut down to set bypass ", "%s LDO%d enabled, must be shut down to set bypass ",
__func__, rid); __func__, rid);
return -EBUSY; return -EBUSY;
} }
ret = regulator_set_bypass_regmap(dev, enable); return regulator_set_bypass_regmap(dev, enable);
return ret;
} }
/* Operations permitted on BUCK1/2/3 */ /* Operations permitted on BUCK1/2/3 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment