mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
axp2101: fix the enable test in axp2101_supply_get_voltage()
The enable check read
if(r & (1 << info->en_bit) == 0)
`==` binds tighter than `&`, so this evaluates as `r & ((1 << bit) == 0)`,
i.e. `r & 0`, which is always false. The check never fired, and a supply
that was switched off reported the voltage it would have had if enabled.
Callers cannot tell "off" from "on at this voltage", so anything reading a rail back to confirm it came up gets a false confirmation.
Found by inspection while bringing up another Ingenic target. Not run on
X1000 hardware as I do not have one of these devices.
Change-Id: I19fc89ff33cce047160d826ce2344cc34b26e224
Co-Authored-By: Claude Opus 4.8
This commit is contained in:
parent
612453da48
commit
a13368d0d6
1 changed files with 1 additions and 1 deletions
|
|
@ -355,7 +355,7 @@ int axp2101_supply_get_voltage(int supply)
|
|||
int r = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, info->en_reg);
|
||||
if(r < 0)
|
||||
return AXP2101_SUPPLY_DISABLED;
|
||||
if(r & (1 << info->en_bit) == 0)
|
||||
if((r & (1 << info->en_bit)) == 0)
|
||||
return AXP2101_SUPPLY_DISABLED;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue