aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorBurman Yan <yan_952@hotmail.com>2006-12-19 15:56:11 -0500
committerLen Brown <len.brown@intel.com>2006-12-20 16:54:54 -0500
commit36bcbec7ce21e2e8b3143b11a05747330abeca70 (patch)
treed9ace4d83a5013dbb3cd599e7bc4358ce4cdb980 /drivers/acpi/battery.c
parent5b7b4119553dd7cc0bc200c0d1b1598e158eec9a (diff)
ACPI: replace kmalloc+memset with kzalloc
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c9
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);