1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Zero the _BST, _BIF, and battinfo allocations. This is needed since we

later sum capacities for all batteries, even those that weren't actually
present.  We only need to do this for _BST but do it for all of them.

Reported by:	Eric Anderson
MFC after:	1 day
This commit is contained in:
Nate Lawson 2005-07-28 18:19:50 +00:00
parent e770771a78
commit 50d0e47aa7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148489

View File

@ -143,9 +143,9 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_battinfo *battinfo)
* Allocate storage for all _BST data, their derived battinfo data,
* and the current battery's _BIF data.
*/
bst = malloc(devcount * sizeof(*bst), M_TEMP, M_WAITOK);
bi = malloc(devcount * sizeof(*bi), M_TEMP, M_WAITOK);
bif = malloc(sizeof(*bif), M_TEMP, M_WAITOK);
bst = malloc(devcount * sizeof(*bst), M_TEMP, M_WAITOK | M_ZERO);
bi = malloc(devcount * sizeof(*bi), M_TEMP, M_WAITOK | M_ZERO);
bif = malloc(sizeof(*bif), M_TEMP, M_WAITOK | M_ZERO);
/*
* Pass 1: for each battery that is present and valid, get its status,