aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd
diff options
context:
space:
mode:
authorJosef 'Jeff' Sipek <jeffpc@josefsipek.net>2024-04-16 23:01:28 +0000
committerEd Maste <emaste@FreeBSD.org>2024-04-16 23:39:45 +0000
commit2e850b832f5d2adb9b230d191277d67c00caaab9 (patch)
tree2d764abdb990fc9b75ce6a632eed8a26e6f05868 /cddl/contrib/opensolaris/cmd
parent9d975e47d5a3638d4f575b2cf97e07bf22b53c7e (diff)
downloadsrc-main.tar.gz
src-main.zip
acpi_battery: avoid divide-by-zero when no devices have capacity infoHEADmain
On laptops with builtin batteries, disconnecting the battery may show up as a battery without any capacity information. (The theory is that one is disconnecting the cells but the electronics identifying the battery are still connected.) As a result, the loop over all batteries in acpi_battery_get_battinfo results in total_lfcap == 0. So, just check that total_lfcap is non-zero to avoid a division by zero (triggerable by sysctl hw.acpi.battery). Reported by: Stefano Marinelli Tested by: Stefano Marinelli Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D44818
Diffstat (limited to 'cddl/contrib/opensolaris/cmd')
0 files changed, 0 insertions, 0 deletions