mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
extres: regulator: Fix regulator_status for already enable regulators
If a regulator hasn't been enable by a driver but is enabled in hardware (most likely enabled by U-Boot), regulator_status will returns that it is enabled and so any call to regulator_disable will panic as it wasn't enabled by one of our drivers. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30293
This commit is contained in:
parent
ce41765c21
commit
f52072b06d
1 changed files with 4 additions and 0 deletions
|
|
@ -985,6 +985,10 @@ regulator_status(regulator_t reg, int *status)
|
|||
KASSERT(regnode->ref_cnt > 0,
|
||||
("Attempt to access unreferenced regulator: %s\n", regnode->name));
|
||||
|
||||
if (reg->enable_cnt == 0) {
|
||||
*status = 0;
|
||||
return (0);
|
||||
}
|
||||
REG_TOPO_SLOCK();
|
||||
rv = regnode_status(regnode, status);
|
||||
REG_TOPO_UNLOCK();
|
||||
|
|
|
|||
Loading…
Reference in a new issue