git: 97db601428e9 - main - axp81x: Always set the delay of the regulator methods
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 09:31:59 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=97db601428e9118aa45a8ac3da4f904fa21b25ef
commit 97db601428e9118aa45a8ac3da4f904fa21b25ef
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-12 08:48:46 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-12 09:31:28 +0000
axp81x: Always set the delay of the regulator methods
axp8xx_regnode_set_voltage() and axp8xx_regnode_enable() only set the
delay when they succeeded, so the callers could use an uninitialized
value after an error. Set it first like the default methods do.
Reported by: llm-postcr
Tested on: A64
---
sys/arm/allwinner/axp81x.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys/arm/allwinner/axp81x.c b/sys/arm/allwinner/axp81x.c
index 80e01fca8745..1c8c0e66e066 100644
--- a/sys/arm/allwinner/axp81x.c
+++ b/sys/arm/allwinner/axp81x.c
@@ -897,6 +897,8 @@ axp8xx_regnode_enable(struct regnode *regnode, bool enable, int *udelay)
uint8_t val;
int error;
+ *udelay = 0;
+
sc = regnode_get_softc(regnode);
asc = device_get_softc(sc->base_dev);
@@ -927,8 +929,6 @@ axp8xx_regnode_enable(struct regnode *regnode, bool enable, int *udelay)
if (error != 0)
return (EIO);
- *udelay = 0;
-
return (0);
}
@@ -995,6 +995,8 @@ axp8xx_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
struct axp8xx_reg_sc *sc;
uint8_t val;
+ *udelay = 0;
+
sc = regnode_get_softc(regnode);
if (bootverbose)
@@ -1012,8 +1014,6 @@ axp8xx_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
if (axp8xx_write(sc->base_dev, sc->def->voltage_reg, val) != 0)
return (EIO);
- *udelay = 0;
-
return (0);
}