Re: git: 010f31a79c43 - main - regulator: Do not delay when setting the voltage failed
- In reply to: Emmanuel Vadot : "git: 010f31a79c43 - main - regulator: Do not delay when setting the voltage failed"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 15 Nov 2026 09:02:59 UTC
On 12. 11. 2026 10:31, Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=010f31a79c4313344a05df768ea31429ec7a9fd6 > > commit 010f31a79c4313344a05df768ea31429ec7a9fd6 > Author: Emmanuel Vadot <manu@FreeBSD.org> > AuthorDate: 2026-11-12 08:44:24 +0000 > Commit: Emmanuel Vadot <manu@FreeBSD.org> > CommitDate: 2026-11-12 09:31:23 +0000 > > regulator: Do not delay when setting the voltage failed > > regnode_set_voltage_checked() called regnode_delay() with the delay > returned by the driver even when REGNODE_SET_VOLTAGE() failed. A driver > does not have to set it on error, so the delay could be a random value > from the stack. Only wait when the voltage was set, like > regnode_set_voltage() does. I think this change is wrong. A failed operation may legitimately want to use delay() to stabilise the system state after an internal operation, even if it fails. Each driver should be responsible for setting udelay to a defined value, even in the event of a failure. Of course, we could help by setting udelay to 0 before REGNODE_SET_VOLTAGE() is called. Michal > > Reported by: llm-postcr > Tested on: A64 > --- > sys/dev/regulator/regulator.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sys/dev/regulator/regulator.c b/sys/dev/regulator/regulator.c > index 6b49c6e93aae..b59710b8aef0 100644 > --- a/sys/dev/regulator/regulator.c > +++ b/sys/dev/regulator/regulator.c > @@ -827,7 +827,8 @@ regnode_set_voltage_checked(struct regnode *regnode, struct regulator *reg, > max_uvolt = all_max_uvolt; > > rv = REGNODE_SET_VOLTAGE(regnode, min_uvolt, max_uvolt, &udelay); > - regnode_delay(udelay); > + if (rv == 0) > + regnode_delay(udelay); > REGNODE_UNLOCK(regnode); > return (rv); > } >