aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/acpi/ac.c3
-rw-r--r--drivers/acpi/acpi_memhotplug.c3
-rw-r--r--drivers/acpi/asus_acpi.c3
-rw-r--r--drivers/acpi/battery.c9
-rw-r--r--drivers/acpi/container.c3
-rw-r--r--drivers/acpi/ec.c9
-rw-r--r--drivers/acpi/fan.c3
-rw-r--r--drivers/acpi/i2c_ec.c6
-rw-r--r--drivers/acpi/ibm_acpi.c3
-rw-r--r--drivers/acpi/pci_bind.c16
-rw-r--r--drivers/acpi/pci_irq.c9
-rw-r--r--drivers/acpi/pci_link.c6
-rw-r--r--drivers/acpi/pci_root.c3
-rw-r--r--drivers/acpi/power.c3
-rw-r--r--drivers/acpi/processor_core.c3
-rw-r--r--drivers/acpi/sbs.c3
-rw-r--r--drivers/acpi/scan.c3
-rw-r--r--drivers/acpi/thermal.c7
-rw-r--r--drivers/acpi/utils.c6
-rw-r--r--drivers/acpi/video.c10
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c3
21 files changed, 37 insertions, 77 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 46e58663dcb5..6daeace796a8 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -221,10 +221,9 @@ static int acpi_ac_add(struct acpi_device *device)
221 if (!device) 221 if (!device)
222 return -EINVAL; 222 return -EINVAL;
223 223
224 ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL); 224 ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
225 if (!ac) 225 if (!ac)
226 return -ENOMEM; 226 return -ENOMEM;
227 memset(ac, 0, sizeof(struct acpi_ac));
228 227
229 ac->device = device; 228 ac->device = device;
230 strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME); 229 strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 150112ae48ed..cd946ed192d3 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -395,10 +395,9 @@ static int acpi_memory_device_add(struct acpi_device *device)
395 if (!device) 395 if (!device)
396 return -EINVAL; 396 return -EINVAL;
397 397
398 mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); 398 mem_device = kzalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
399 if (!mem_device) 399 if (!mem_device)
400 return -ENOMEM; 400 return -ENOMEM;
401 memset(mem_device, 0, sizeof(struct acpi_memory_device));
402 401
403 INIT_LIST_HEAD(&mem_device->res_list); 402 INIT_LIST_HEAD(&mem_device->res_list);
404 mem_device->device = device; 403 mem_device->device = device;
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index 7cc54aacd4c0..396140bbbe57 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1264,10 +1264,9 @@ static int asus_hotk_add(struct acpi_device *device)
1264 printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n", 1264 printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n",
1265 ASUS_ACPI_VERSION); 1265 ASUS_ACPI_VERSION);
1266 1266
1267 hotk = kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); 1267 hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL);
1268 if (!hotk) 1268 if (!hotk)
1269 return -ENOMEM; 1269 return -ENOMEM;
1270 memset(hotk, 0, sizeof(struct asus_hotk));
1271 1270
1272 hotk->handle = device->handle; 1271 hotk->handle = device->handle;
1273 strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME); 1272 strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME);
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);
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index a15381789462..0a1863ec91f3 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -96,11 +96,10 @@ static int acpi_container_add(struct acpi_device *device)
96 return -EINVAL; 96 return -EINVAL;
97 } 97 }
98 98
99 container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); 99 container = kzalloc(sizeof(struct acpi_container), GFP_KERNEL);
100 if (!container) 100 if (!container)
101 return -ENOMEM; 101 return -ENOMEM;
102 102
103 memset(container, 0, sizeof(struct acpi_container));
104 container->handle = device->handle; 103 container->handle = device->handle;
105 strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME); 104 strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME);
106 strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS); 105 strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 08c12588af69..9c52d87d6f04 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -624,10 +624,9 @@ static int acpi_ec_add(struct acpi_device *device)
624 if (!device) 624 if (!device)
625 return -EINVAL; 625 return -EINVAL;
626 626
627 ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 627 ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
628 if (!ec) 628 if (!ec)
629 return -ENOMEM; 629 return -ENOMEM;
630 memset(ec, 0, sizeof(struct acpi_ec));
631 630
632 ec->handle = device->handle; 631 ec->handle = device->handle;
633 ec->uid = -1; 632 ec->uid = -1;
@@ -848,12 +847,11 @@ static int __init acpi_ec_fake_ecdt(void)
848 847
849 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Try to make an fake ECDT")); 848 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Try to make an fake ECDT"));
850 849
851 ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 850 ec_ecdt = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
852 if (!ec_ecdt) { 851 if (!ec_ecdt) {
853 ret = -ENOMEM; 852 ret = -ENOMEM;
854 goto error; 853 goto error;
855 } 854 }
856 memset(ec_ecdt, 0, sizeof(struct acpi_ec));
857 855
858 status = acpi_get_devices(ACPI_EC_HID, 856 status = acpi_get_devices(ACPI_EC_HID,
859 acpi_fake_ecdt_callback, NULL, NULL); 857 acpi_fake_ecdt_callback, NULL, NULL);
@@ -885,10 +883,9 @@ static int __init acpi_ec_get_real_ecdt(void)
885 /* 883 /*
886 * Generate a temporary ec context to use until the namespace is scanned 884 * Generate a temporary ec context to use until the namespace is scanned
887 */ 885 */
888 ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 886 ec_ecdt = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
889 if (!ec_ecdt) 887 if (!ec_ecdt)
890 return -ENOMEM; 888 return -ENOMEM;
891 memset(ec_ecdt, 0, sizeof(struct acpi_ec));
892 889
893 mutex_init(&ec_ecdt->lock); 890 mutex_init(&ec_ecdt->lock);
894 if (acpi_ec_mode == EC_INTR) { 891 if (acpi_ec_mode == EC_INTR) {
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index c413e69fea8e..f305a826ca2d 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -186,10 +186,9 @@ static int acpi_fan_add(struct acpi_device *device)
186 if (!device) 186 if (!device)
187 return -EINVAL; 187 return -EINVAL;
188 188
189 fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL); 189 fan = kzalloc(sizeof(struct acpi_fan), GFP_KERNEL);
190 if (!fan) 190 if (!fan)
191 return -ENOMEM; 191 return -ENOMEM;
192 memset(fan, 0, sizeof(struct acpi_fan));
193 192
194 fan->device = device; 193 fan->device = device;
195 strcpy(acpi_device_name(device), "Fan"); 194 strcpy(acpi_device_name(device), "Fan");
diff --git a/drivers/acpi/i2c_ec.c b/drivers/acpi/i2c_ec.c
index 82e3e64483fb..8338be0990bc 100644
--- a/drivers/acpi/i2c_ec.c
+++ b/drivers/acpi/i2c_ec.c
@@ -309,18 +309,16 @@ static int acpi_ec_hc_add(struct acpi_device *device)
309 return -EINVAL; 309 return -EINVAL;
310 } 310 }
311 311
312 ec_hc = kmalloc(sizeof(struct acpi_ec_hc), GFP_KERNEL); 312 ec_hc = kzalloc(sizeof(struct acpi_ec_hc), GFP_KERNEL);
313 if (!ec_hc) { 313 if (!ec_hc) {
314 return -ENOMEM; 314 return -ENOMEM;
315 } 315 }
316 memset(ec_hc, 0, sizeof(struct acpi_ec_hc));
317 316
318 smbus = kmalloc(sizeof(struct acpi_ec_smbus), GFP_KERNEL); 317 smbus = kzalloc(sizeof(struct acpi_ec_smbus), GFP_KERNEL);
319 if (!smbus) { 318 if (!smbus) {
320 kfree(ec_hc); 319 kfree(ec_hc);
321 return -ENOMEM; 320 return -ENOMEM;
322 } 321 }
323 memset(smbus, 0, sizeof(struct acpi_ec_smbus));
324 322
325 ec_hc->handle = device->handle; 323 ec_hc->handle = device->handle;
326 strcpy(acpi_device_name(device), ACPI_EC_HC_DEVICE_NAME); 324 strcpy(acpi_device_name(device), ACPI_EC_HC_DEVICE_NAME);
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 130cc8c37e22..0e7682a88aa8 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -2516,13 +2516,12 @@ static int __init register_driver(struct ibm_struct *ibm)
2516{ 2516{
2517 int ret; 2517 int ret;
2518 2518
2519 ibm->driver = kmalloc(sizeof(struct acpi_driver), GFP_KERNEL); 2519 ibm->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
2520 if (!ibm->driver) { 2520 if (!ibm->driver) {
2521 printk(IBM_ERR "kmalloc(ibm->driver) failed\n"); 2521 printk(IBM_ERR "kmalloc(ibm->driver) failed\n");
2522 return -1; 2522 return -1;
2523 } 2523 }
2524 2524
2525 memset(ibm->driver, 0, sizeof(struct acpi_driver));
2526 sprintf(ibm->driver->name, "%s_%s", IBM_NAME, ibm->name); 2525 sprintf(ibm->driver->name, "%s_%s", IBM_NAME, ibm->name);
2527 ibm->driver->ids = ibm->hid; 2526 ibm->driver->ids = ibm->hid;
2528 ibm->driver->ops.add = &ibm_device_add; 2527 ibm->driver->ops.add = &ibm_device_add;
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c
index 70b440f3f262..55f57a61c55e 100644
--- a/drivers/acpi/pci_bind.c
+++ b/drivers/acpi/pci_bind.c
@@ -122,19 +122,17 @@ int acpi_pci_bind(struct acpi_device *device)
122 if (!device || !device->parent) 122 if (!device || !device->parent)
123 return -EINVAL; 123 return -EINVAL;
124 124
125 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 125 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
126 if (!pathname) 126 if (!pathname)
127 return -ENOMEM; 127 return -ENOMEM;
128 memset(pathname, 0, ACPI_PATHNAME_MAX);
129 buffer.length = ACPI_PATHNAME_MAX; 128 buffer.length = ACPI_PATHNAME_MAX;
130 buffer.pointer = pathname; 129 buffer.pointer = pathname;
131 130
132 data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); 131 data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
133 if (!data) { 132 if (!data) {
134 kfree(pathname); 133 kfree(pathname);
135 return -ENOMEM; 134 return -ENOMEM;
136 } 135 }
137 memset(data, 0, sizeof(struct acpi_pci_data));
138 136
139 acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); 137 acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
140 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", 138 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n",
@@ -281,10 +279,9 @@ int acpi_pci_unbind(struct acpi_device *device)
281 if (!device || !device->parent) 279 if (!device || !device->parent)
282 return -EINVAL; 280 return -EINVAL;
283 281
284 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 282 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
285 if (!pathname) 283 if (!pathname)
286 return -ENOMEM; 284 return -ENOMEM;
287 memset(pathname, 0, ACPI_PATHNAME_MAX);
288 285
289 buffer.length = ACPI_PATHNAME_MAX; 286 buffer.length = ACPI_PATHNAME_MAX;
290 buffer.pointer = pathname; 287 buffer.pointer = pathname;
@@ -331,11 +328,9 @@ acpi_pci_bind_root(struct acpi_device *device,
331 char *pathname = NULL; 328 char *pathname = NULL;
332 struct acpi_buffer buffer = { 0, NULL }; 329 struct acpi_buffer buffer = { 0, NULL };
333 330
334 331 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
335 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
336 if (!pathname) 332 if (!pathname)
337 return -ENOMEM; 333 return -ENOMEM;
338 memset(pathname, 0, ACPI_PATHNAME_MAX);
339 334
340 buffer.length = ACPI_PATHNAME_MAX; 335 buffer.length = ACPI_PATHNAME_MAX;
341 buffer.pointer = pathname; 336 buffer.pointer = pathname;
@@ -345,12 +340,11 @@ acpi_pci_bind_root(struct acpi_device *device,
345 return -EINVAL; 340 return -EINVAL;
346 } 341 }
347 342
348 data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); 343 data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
349 if (!data) { 344 if (!data) {
350 kfree(pathname); 345 kfree(pathname);
351 return -ENOMEM; 346 return -ENOMEM;
352 } 347 }
353 memset(data, 0, sizeof(struct acpi_pci_data));
354 348
355 data->id = *id; 349 data->id = *id;
356 data->bus = bus; 350 data->bus = bus;
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 226892eaf987..fe7d007833ad 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -89,10 +89,9 @@ acpi_pci_irq_add_entry(acpi_handle handle,
89 if (!prt) 89 if (!prt)
90 return -EINVAL; 90 return -EINVAL;
91 91
92 entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); 92 entry = kzalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL);
93 if (!entry) 93 if (!entry)
94 return -ENOMEM; 94 return -ENOMEM;
95 memset(entry, 0, sizeof(struct acpi_prt_entry));
96 95
97 entry->id.segment = segment; 96 entry->id.segment = segment;
98 entry->id.bus = bus; 97 entry->id.bus = bus;
@@ -161,10 +160,9 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
161 static int first_time = 1; 160 static int first_time = 1;
162 161
163 162
164 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 163 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
165 if (!pathname) 164 if (!pathname)
166 return -ENOMEM; 165 return -ENOMEM;
167 memset(pathname, 0, ACPI_PATHNAME_MAX);
168 166
169 if (first_time) { 167 if (first_time) {
170 acpi_prt.count = 0; 168 acpi_prt.count = 0;
@@ -198,11 +196,10 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
198 return -ENODEV; 196 return -ENODEV;
199 } 197 }
200 198
201 prt = kmalloc(buffer.length, GFP_KERNEL); 199 prt = kzalloc(buffer.length, GFP_KERNEL);
202 if (!prt) { 200 if (!prt) {
203 return -ENOMEM; 201 return -ENOMEM;
204 } 202 }
205 memset(prt, 0, buffer.length);
206 buffer.pointer = prt; 203 buffer.pointer = prt;
207 204
208 status = acpi_get_irq_routing_table(handle, &buffer); 205 status = acpi_get_irq_routing_table(handle, &buffer);
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 812d733fe816..481e633bbf41 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -307,11 +307,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
307 if (!link || !irq) 307 if (!link || !irq)
308 return -EINVAL; 308 return -EINVAL;
309 309
310 resource = kmalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); 310 resource = kzalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
311 if (!resource) 311 if (!resource)
312 return -ENOMEM; 312 return -ENOMEM;
313 313
314 memset(resource, 0, sizeof(*resource) + 1);
315 buffer.length = sizeof(*resource) + 1; 314 buffer.length = sizeof(*resource) + 1;
316 buffer.pointer = resource; 315 buffer.pointer = resource;
317 316
@@ -718,10 +717,9 @@ static int acpi_pci_link_add(struct acpi_device *device)
718 if (!device) 717 if (!device)
719 return -EINVAL; 718 return -EINVAL;
720 719
721 link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); 720 link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL);
722 if (!link) 721 if (!link)
723 return -ENOMEM; 722 return -ENOMEM;
724 memset(link, 0, sizeof(struct acpi_pci_link));
725 723
726 link->device = device; 724 link->device = device;
727 strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); 725 strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index b9c52cdbf658..a860efa2c562 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -165,10 +165,9 @@ static int acpi_pci_root_add(struct acpi_device *device)
165 if (!device) 165 if (!device)
166 return -EINVAL; 166 return -EINVAL;
167 167
168 root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); 168 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
169 if (!root) 169 if (!root)
170 return -ENOMEM; 170 return -ENOMEM;
171 memset(root, 0, sizeof(struct acpi_pci_root));
172 INIT_LIST_HEAD(&root->node); 171 INIT_LIST_HEAD(&root->node);
173 172
174 root->device = device; 173 root->device = device;
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 23a8a9295578..0ba7dfbbb2ee 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -532,10 +532,9 @@ static int acpi_power_add(struct acpi_device *device)
532 if (!device) 532 if (!device)
533 return -EINVAL; 533 return -EINVAL;
534 534
535 resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); 535 resource = kzalloc(sizeof(struct acpi_power_resource), GFP_KERNEL);
536 if (!resource) 536 if (!resource)
537 return -ENOMEM; 537 return -ENOMEM;
538 memset(resource, 0, sizeof(struct acpi_power_resource));
539 538
540 resource->device = device; 539 resource->device = device;
541 strcpy(resource->name, device->pnp.bus_id); 540 strcpy(resource->name, device->pnp.bus_id);
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 89b3610feb47..25718fed39f1 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -615,10 +615,9 @@ static int acpi_processor_add(struct acpi_device *device)
615 if (!device) 615 if (!device)
616 return -EINVAL; 616 return -EINVAL;
617 617
618 pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL); 618 pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
619 if (!pr) 619 if (!pr)
620 return -ENOMEM; 620 return -ENOMEM;
621 memset(pr, 0, sizeof(struct acpi_processor));
622 621
623 pr->handle = device->handle; 622 pr->handle = device->handle;
624 strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); 623 strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 2fb7533314cd..f58fc7447ab4 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -1576,12 +1576,11 @@ static int acpi_sbs_add(struct acpi_device *device)
1576 int id, cnt; 1576 int id, cnt;
1577 acpi_status status = AE_OK; 1577 acpi_status status = AE_OK;
1578 1578
1579 sbs = kmalloc(sizeof(struct acpi_sbs), GFP_KERNEL); 1579 sbs = kzalloc(sizeof(struct acpi_sbs), GFP_KERNEL);
1580 if (!sbs) { 1580 if (!sbs) {
1581 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "kmalloc() failed\n")); 1581 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "kmalloc() failed\n"));
1582 return -ENOMEM; 1582 return -ENOMEM;
1583 } 1583 }
1584 memset(sbs, 0, sizeof(struct acpi_sbs));
1585 1584
1586 cnt = 0; 1585 cnt = 0;
1587 while (cnt < 10) { 1586 while (cnt < 10) {
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 698a1540e303..283d87522c5d 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -984,12 +984,11 @@ acpi_add_single_object(struct acpi_device **child,
984 if (!child) 984 if (!child)
985 return -EINVAL; 985 return -EINVAL;
986 986
987 device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); 987 device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
988 if (!device) { 988 if (!device) {
989 printk(KERN_ERR PREFIX "Memory allocation error\n"); 989 printk(KERN_ERR PREFIX "Memory allocation error\n");
990 return -ENOMEM; 990 return -ENOMEM;
991 } 991 }
992 memset(device, 0, sizeof(struct acpi_device));
993 992
994 device->handle = handle; 993 device->handle = handle;
995 device->parent = parent; 994 device->parent = parent;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 4d75085ca2d2..40ddb4dd9631 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -902,12 +902,10 @@ acpi_thermal_write_trip_points(struct file *file,
902 int i = 0; 902 int i = 0;
903 903
904 904
905 limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); 905 limit_string = kzalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL);
906 if (!limit_string) 906 if (!limit_string)
907 return -ENOMEM; 907 return -ENOMEM;
908 908
909 memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);
910
911 active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); 909 active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
912 if (!active) { 910 if (!active) {
913 kfree(limit_string); 911 kfree(limit_string);
@@ -1271,10 +1269,9 @@ static int acpi_thermal_add(struct acpi_device *device)
1271 if (!device) 1269 if (!device)
1272 return -EINVAL; 1270 return -EINVAL;
1273 1271
1274 tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); 1272 tz = kzalloc(sizeof(struct acpi_thermal), GFP_KERNEL);
1275 if (!tz) 1273 if (!tz)
1276 return -ENOMEM; 1274 return -ENOMEM;
1277 memset(tz, 0, sizeof(struct acpi_thermal));
1278 1275
1279 tz->device = device; 1276 tz->device = device;
1280 strcpy(tz->name, device->pnp.bus_id); 1277 strcpy(tz->name, device->pnp.bus_id);
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 91fed70a65a6..68a809fa7b19 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -262,11 +262,10 @@ acpi_evaluate_integer(acpi_handle handle,
262 if (!data) 262 if (!data)
263 return AE_BAD_PARAMETER; 263 return AE_BAD_PARAMETER;
264 264
265 element = kmalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); 265 element = kzalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
266 if (!element) 266 if (!element)
267 return AE_NO_MEMORY; 267 return AE_NO_MEMORY;
268 268
269 memset(element, 0, sizeof(union acpi_object));
270 buffer.length = sizeof(union acpi_object); 269 buffer.length = sizeof(union acpi_object);
271 buffer.pointer = element; 270 buffer.pointer = element;
272 status = acpi_evaluate_object(handle, pathname, arguments, &buffer); 271 status = acpi_evaluate_object(handle, pathname, arguments, &buffer);
@@ -321,12 +320,11 @@ acpi_evaluate_string(acpi_handle handle,
321 return AE_BAD_DATA; 320 return AE_BAD_DATA;
322 } 321 }
323 322
324 *data = kmalloc(element->string.length + 1, GFP_KERNEL); 323 *data = kzalloc(element->string.length + 1, GFP_KERNEL);
325 if (!data) { 324 if (!data) {
326 printk(KERN_ERR PREFIX "Memory allocation\n"); 325 printk(KERN_ERR PREFIX "Memory allocation\n");
327 return -ENOMEM; 326 return -ENOMEM;
328 } 327 }
329 memset(*data, 0, element->string.length + 1);
330 328
331 memcpy(*data, element->string.pointer, element->string.length); 329 memcpy(*data, element->string.pointer, element->string.length);
332 330
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index eb5141f9ef8f..36b37d755dbc 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -533,11 +533,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
533 int count = 0; 533 int count = 0;
534 union acpi_object *o; 534 union acpi_object *o;
535 535
536 br = kmalloc(sizeof(*br), GFP_KERNEL); 536 br = kzalloc(sizeof(*br), GFP_KERNEL);
537 if (!br) { 537 if (!br) {
538 printk(KERN_ERR "can't allocate memory\n"); 538 printk(KERN_ERR "can't allocate memory\n");
539 } else { 539 } else {
540 memset(br, 0, sizeof(*br));
541 br->levels = kmalloc(obj->package.count * 540 br->levels = kmalloc(obj->package.count *
542 sizeof *(br->levels), GFP_KERNEL); 541 sizeof *(br->levels), GFP_KERNEL);
543 if (!br->levels) 542 if (!br->levels)
@@ -1260,12 +1259,10 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1260 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); 1259 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
1261 if (ACPI_SUCCESS(status)) { 1260 if (ACPI_SUCCESS(status)) {
1262 1261
1263 data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); 1262 data = kzalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
1264 if (!data) 1263 if (!data)
1265 return -ENOMEM; 1264 return -ENOMEM;
1266 1265
1267 memset(data, 0, sizeof(struct acpi_video_device));
1268
1269 strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); 1266 strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
1270 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); 1267 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
1271 acpi_driver_data(device) = data; 1268 acpi_driver_data(device) = data;
@@ -1718,10 +1715,9 @@ static int acpi_video_bus_add(struct acpi_device *device)
1718 if (!device) 1715 if (!device)
1719 return -EINVAL; 1716 return -EINVAL;
1720 1717
1721 video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); 1718 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
1722 if (!video) 1719 if (!video)
1723 return -ENOMEM; 1720 return -ENOMEM;
1724 memset(video, 0, sizeof(struct acpi_video_bus));
1725 1721
1726 video->device = device; 1722 video->device = device;
1727 strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); 1723 strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index bd40aee10e16..7f03881a8b68 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -319,13 +319,12 @@ static int ibm_get_table_from_acpi(char **bufp)
319 if (bufp == NULL) 319 if (bufp == NULL)
320 goto read_table_done; 320 goto read_table_done;
321 321
322 lbuf = kmalloc(size, GFP_KERNEL); 322 lbuf = kzalloc(size, GFP_KERNEL);
323 dbg("%s: element count: %i, ASL table size: %i, &table = 0x%p\n", 323 dbg("%s: element count: %i, ASL table size: %i, &table = 0x%p\n",
324 __FUNCTION__, package->package.count, size, lbuf); 324 __FUNCTION__, package->package.count, size, lbuf);
325 325
326 if (lbuf) { 326 if (lbuf) {
327 *bufp = lbuf; 327 *bufp = lbuf;
328 memset(lbuf, 0, size);
329 } else { 328 } else {
330 size = -ENOMEM; 329 size = -ENOMEM;
331 goto read_table_done; 330 goto read_table_done;