diff options
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index f47c78a10656..5f43e0d14899 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -160,12 +160,11 @@ acpi_battery_get_info(struct acpi_battery *battery, | |||
160 | goto end; | 160 | goto end; |
161 | } | 161 | } |
162 | 162 | ||
163 | data.pointer = kmalloc(data.length, GFP_KERNEL); | 163 | data.pointer = kzalloc(data.length, GFP_KERNEL); |
164 | if (!data.pointer) { | 164 | if (!data.pointer) { |
165 | result = -ENOMEM; | 165 | result = -ENOMEM; |
166 | goto end; | 166 | goto end; |
167 | } | 167 | } |
168 | memset(data.pointer, 0, data.length); | ||
169 | 168 | ||
170 | status = acpi_extract_package(package, &format, &data); | 169 | status = acpi_extract_package(package, &format, &data); |
171 | if (ACPI_FAILURE(status)) { | 170 | if (ACPI_FAILURE(status)) { |
@@ -220,12 +219,11 @@ acpi_battery_get_status(struct acpi_battery *battery, | |||
220 | goto end; | 219 | goto end; |
221 | } | 220 | } |
222 | 221 | ||
223 | data.pointer = kmalloc(data.length, GFP_KERNEL); | 222 | data.pointer = kzalloc(data.length, GFP_KERNEL); |
224 | if (!data.pointer) { | 223 | if (!data.pointer) { |
225 | result = -ENOMEM; | 224 | result = -ENOMEM; |
226 | goto end; | 225 | goto end; |
227 | } | 226 | } |
228 | memset(data.pointer, 0, data.length); | ||
229 | 227 | ||
230 | status = acpi_extract_package(package, &format, &data); | 228 | status = acpi_extract_package(package, &format, &data); |
231 | if (ACPI_FAILURE(status)) { | 229 | if (ACPI_FAILURE(status)) { |
@@ -694,10 +692,9 @@ static int acpi_battery_add(struct acpi_device *device) | |||
694 | if (!device) | 692 | if (!device) |
695 | return -EINVAL; | 693 | return -EINVAL; |
696 | 694 | ||
697 | battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL); | 695 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); |
698 | if (!battery) | 696 | if (!battery) |
699 | return -ENOMEM; | 697 | return -ENOMEM; |
700 | memset(battery, 0, sizeof(struct acpi_battery)); | ||
701 | 698 | ||
702 | battery->device = device; | 699 | battery->device = device; |
703 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); | 700 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); |