summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-03-18 12:01:06 +0100
committerTom Rini <trini@konsulko.com>2018-04-06 20:45:28 -0400
commitc57b6b7090eab6a83c57175185e53166ab532675 (patch)
tree4c0c2281eb94a6582fdb67c179241fb21f67cd11 /drivers/power
parent62896dcbf37b478f7f719e2ce456d9bfe91a291a (diff)
downloadu-boot-c57b6b7090eab6a83c57175185e53166ab532675.tar.gz
regulator: pbias: don't evaluate variable before assignment
We should not evaluate the value of reg before its value is set. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/regulator/pbias_regulator.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c
index 116b7f480a..adf589b224 100644
--- a/drivers/power/regulator/pbias_regulator.c
+++ b/drivers/power/regulator/pbias_regulator.c
@@ -225,9 +225,6 @@ static int pbias_regulator_set_value(struct udevice *dev, int uV)
int rc;
u32 reg;
- debug("Setting %s voltage to %s\n", p->name,
- (reg & p->vmode) ? "3.0v" : "1.8v");
-
rc = pmic_read(dev->parent, 0, (uint8_t *)&reg, sizeof(reg));
if (rc)
return rc;
@@ -239,6 +236,9 @@ static int pbias_regulator_set_value(struct udevice *dev, int uV)
else
return -EINVAL;
+ debug("Setting %s voltage to %s\n", p->name,
+ (reg & p->vmode) ? "3.0v" : "1.8v");
+
return pmic_write(dev->parent, 0, (uint8_t *)&reg, sizeof(reg));
}