Skip to contentSkip to conversation

regulator: pbias: don't evaluate variable before assignment

PATCH New Heinrich Schuchardt 3 participants 3 messages Mar 18, 2018 – Apr 7, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: pbias: don't evaluate variable before assignment

We should not evaluate the value of reg before its value is set.

---
 drivers/power/regulator/pbias_regulator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/power/regulator/pbias_regulator.c +3 -3
index 116b7f480a..adf589b224 100644
@@ -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));
 }
 
Signature · 1 line
2.16.2
#2 lore raw

PATCH 1/1 regulator: pbias: don't evaluate variable before assignment

In reply to Heinrich Schuchardt
Quoted 4 lines · Heinrich Schuchardt

We should not evaluate the value of reg before its value is set.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180407/f839c3e9/attachment.sig>