aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c14
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c9
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c13
-rw-r--r--drivers/pci/hotplug/fakephp.c9
-rw-r--r--drivers/pci/hotplug/ibmphp_core.c6
-rw-r--r--drivers/pci/hotplug/ibmphp_ebda.c57
-rw-r--r--drivers/pci/hotplug/ibmphp_pci.c63
-rw-r--r--drivers/pci/hotplug/ibmphp_res.c33
-rw-r--r--drivers/pci/hotplug/pciehp_core.c13
-rw-r--r--drivers/pci/hotplug/rpaphp_slot.c9
-rw-r--r--drivers/pci/pci-driver.c3
-rw-r--r--drivers/pci/pci-sysfs.c3
-rw-r--r--drivers/pci/pcie/portdrv_core.c3
-rw-r--r--drivers/pci/probe.c9
14 files changed, 75 insertions, 169 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index cbd5893d198e..c7e6387983df 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -143,10 +143,9 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
143 device = (adr >> 16) & 0xffff; 143 device = (adr >> 16) & 0xffff;
144 function = adr & 0xffff; 144 function = adr & 0xffff;
145 145
146 newfunc = kmalloc(sizeof(struct acpiphp_func), GFP_KERNEL); 146 newfunc = kzalloc(sizeof(struct acpiphp_func), GFP_KERNEL);
147 if (!newfunc) 147 if (!newfunc)
148 return AE_NO_MEMORY; 148 return AE_NO_MEMORY;
149 memset(newfunc, 0, sizeof(struct acpiphp_func));
150 149
151 INIT_LIST_HEAD(&newfunc->sibling); 150 INIT_LIST_HEAD(&newfunc->sibling);
152 newfunc->handle = handle; 151 newfunc->handle = handle;
@@ -189,13 +188,12 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
189 } 188 }
190 189
191 if (!slot) { 190 if (!slot) {
192 slot = kmalloc(sizeof(struct acpiphp_slot), GFP_KERNEL); 191 slot = kzalloc(sizeof(struct acpiphp_slot), GFP_KERNEL);
193 if (!slot) { 192 if (!slot) {
194 kfree(newfunc); 193 kfree(newfunc);
195 return AE_NO_MEMORY; 194 return AE_NO_MEMORY;
196 } 195 }
197 196
198 memset(slot, 0, sizeof(struct acpiphp_slot));
199 slot->bridge = bridge; 197 slot->bridge = bridge;
200 slot->device = device; 198 slot->device = device;
201 slot->sun = sun; 199 slot->sun = sun;
@@ -376,12 +374,10 @@ static void add_host_bridge(acpi_handle *handle, struct pci_bus *pci_bus)
376{ 374{
377 struct acpiphp_bridge *bridge; 375 struct acpiphp_bridge *bridge;
378 376
379 bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); 377 bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
380 if (bridge == NULL) 378 if (bridge == NULL)
381 return; 379 return;
382 380
383 memset(bridge, 0, sizeof(struct acpiphp_bridge));
384
385 bridge->type = BRIDGE_TYPE_HOST; 381 bridge->type = BRIDGE_TYPE_HOST;
386 bridge->handle = handle; 382 bridge->handle = handle;
387 383
@@ -398,14 +394,12 @@ static void add_p2p_bridge(acpi_handle *handle, struct pci_dev *pci_dev)
398{ 394{
399 struct acpiphp_bridge *bridge; 395 struct acpiphp_bridge *bridge;
400 396
401 bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); 397 bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
402 if (bridge == NULL) { 398 if (bridge == NULL) {
403 err("out of memory\n"); 399 err("out of memory\n");
404 return; 400 return;
405 } 401 }
406 402
407 memset(bridge, 0, sizeof(struct acpiphp_bridge));
408
409 bridge->type = BRIDGE_TYPE_P2P; 403 bridge->type = BRIDGE_TYPE_P2P;
410 bridge->handle = handle; 404 bridge->handle = handle;
411 405
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index 30af105271a2..037ce4c91687 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -248,22 +248,19 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
248 * with the pci_hotplug subsystem. 248 * with the pci_hotplug subsystem.
249 */ 249 */
250 for (i = first; i <= last; ++i) { 250 for (i = first; i <= last; ++i) {
251 slot = kmalloc(sizeof (struct slot), GFP_KERNEL); 251 slot = kzalloc(sizeof (struct slot), GFP_KERNEL);
252 if (!slot) 252 if (!slot)
253 goto error; 253 goto error;
254 memset(slot, 0, sizeof (struct slot));
255 254
256 hotplug_slot = 255 hotplug_slot =
257 kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL); 256 kzalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
258 if (!hotplug_slot) 257 if (!hotplug_slot)
259 goto error_slot; 258 goto error_slot;
260 memset(hotplug_slot, 0, sizeof (struct hotplug_slot));
261 slot->hotplug_slot = hotplug_slot; 259 slot->hotplug_slot = hotplug_slot;
262 260
263 info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL); 261 info = kzalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
264 if (!info) 262 if (!info)
265 goto error_hpslot; 263 goto error_hpslot;
266 memset(info, 0, sizeof (struct hotplug_slot_info));
267 hotplug_slot->info = info; 264 hotplug_slot->info = info;
268 265
269 name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); 266 name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index 8626901daeb8..9bc1deb8df52 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -347,26 +347,22 @@ static int ctrl_slot_setup(struct controller *ctrl,
347 slot_number = ctrl->first_slot; 347 slot_number = ctrl->first_slot;
348 348
349 while (number_of_slots) { 349 while (number_of_slots) {
350 slot = kmalloc(sizeof(*slot), GFP_KERNEL); 350 slot = kzalloc(sizeof(*slot), GFP_KERNEL);
351 if (!slot) 351 if (!slot)
352 goto error; 352 goto error;
353 353
354 memset(slot, 0, sizeof(struct slot)); 354 slot->hotplug_slot = kzalloc(sizeof(*(slot->hotplug_slot)),
355 slot->hotplug_slot = kmalloc(sizeof(*(slot->hotplug_slot)),
356 GFP_KERNEL); 355 GFP_KERNEL);
357 if (!slot->hotplug_slot) 356 if (!slot->hotplug_slot)
358 goto error_slot; 357 goto error_slot;
359 hotplug_slot = slot->hotplug_slot; 358 hotplug_slot = slot->hotplug_slot;
360 memset(hotplug_slot, 0, sizeof(struct hotplug_slot));
361 359
362 hotplug_slot->info = 360 hotplug_slot->info =
363 kmalloc(sizeof(*(hotplug_slot->info)), 361 kzalloc(sizeof(*(hotplug_slot->info)),
364 GFP_KERNEL); 362 GFP_KERNEL);
365 if (!hotplug_slot->info) 363 if (!hotplug_slot->info)
366 goto error_hpslot; 364 goto error_hpslot;
367 hotplug_slot_info = hotplug_slot->info; 365 hotplug_slot_info = hotplug_slot->info;
368 memset(hotplug_slot_info, 0,
369 sizeof(struct hotplug_slot_info));
370 hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); 366 hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
371 367
372 if (!hotplug_slot->name) 368 if (!hotplug_slot->name)
@@ -854,13 +850,12 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
854 goto err_disable_device; 850 goto err_disable_device;
855 } 851 }
856 852
857 ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL); 853 ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL);
858 if (!ctrl) { 854 if (!ctrl) {
859 err("%s : out of memory\n", __FUNCTION__); 855 err("%s : out of memory\n", __FUNCTION__);
860 rc = -ENOMEM; 856 rc = -ENOMEM;
861 goto err_disable_device; 857 goto err_disable_device;
862 } 858 }
863 memset(ctrl, 0, sizeof(struct controller));
864 859
865 rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsystem_deviceid); 860 rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsystem_deviceid);
866 if (rc) { 861 if (rc) {
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 060d74775d7b..71b80c23e8ce 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -95,15 +95,13 @@ static int add_slot(struct pci_dev *dev)
95 struct hotplug_slot *slot; 95 struct hotplug_slot *slot;
96 int retval = -ENOMEM; 96 int retval = -ENOMEM;
97 97
98 slot = kmalloc(sizeof(struct hotplug_slot), GFP_KERNEL); 98 slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
99 if (!slot) 99 if (!slot)
100 goto error; 100 goto error;
101 memset(slot, 0, sizeof(*slot));
102 101
103 slot->info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL); 102 slot->info = kzalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
104 if (!slot->info) 103 if (!slot->info)
105 goto error_slot; 104 goto error_slot;
106 memset(slot->info, 0, sizeof(struct hotplug_slot_info));
107 105
108 slot->info->power_status = 1; 106 slot->info->power_status = 1;
109 slot->info->max_bus_speed = PCI_SPEED_UNKNOWN; 107 slot->info->max_bus_speed = PCI_SPEED_UNKNOWN;
@@ -227,11 +225,10 @@ static void pci_rescan_bus(const struct pci_bus *bus)
227{ 225{
228 unsigned int devfn; 226 unsigned int devfn;
229 struct pci_dev *dev; 227 struct pci_dev *dev;
230 dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); 228 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
231 if (!dev) 229 if (!dev)
232 return; 230 return;
233 231
234 memset(dev, 0, sizeof(dev));
235 dev->bus = (struct pci_bus*)bus; 232 dev->bus = (struct pci_bus*)bus;
236 dev->sysdata = bus->sysdata; 233 dev->sysdata = bus->sysdata;
237 for (devfn = 0; devfn < 0x100; devfn += 8) { 234 for (devfn = 0; devfn < 0x100; devfn += 8) {
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index dc59da675c08..45e2a0d9b596 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -1141,7 +1141,7 @@ static int enable_slot(struct hotplug_slot *hs)
1141 goto error_power; 1141 goto error_power;
1142 } 1142 }
1143 1143
1144 slot_cur->func = kmalloc(sizeof(struct pci_func), GFP_KERNEL); 1144 slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL);
1145 if (!slot_cur->func) { 1145 if (!slot_cur->func) {
1146 /* We cannot do update_slot_info here, since no memory for 1146 /* We cannot do update_slot_info here, since no memory for
1147 * kmalloc n.e.ways, and update_slot_info allocates some */ 1147 * kmalloc n.e.ways, and update_slot_info allocates some */
@@ -1149,7 +1149,6 @@ static int enable_slot(struct hotplug_slot *hs)
1149 rc = -ENOMEM; 1149 rc = -ENOMEM;
1150 goto error_power; 1150 goto error_power;
1151 } 1151 }
1152 memset(slot_cur->func, 0, sizeof(struct pci_func));
1153 slot_cur->func->busno = slot_cur->bus; 1152 slot_cur->func->busno = slot_cur->bus;
1154 slot_cur->func->device = slot_cur->device; 1153 slot_cur->func->device = slot_cur->device;
1155 for (i = 0; i < 4; i++) 1154 for (i = 0; i < 4; i++)
@@ -1252,13 +1251,12 @@ int ibmphp_do_disable_slot(struct slot *slot_cur)
1252 1251
1253 if (slot_cur->func == NULL) { 1252 if (slot_cur->func == NULL) {
1254 /* We need this for fncs's that were there on bootup */ 1253 /* We need this for fncs's that were there on bootup */
1255 slot_cur->func = kmalloc(sizeof(struct pci_func), GFP_KERNEL); 1254 slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL);
1256 if (!slot_cur->func) { 1255 if (!slot_cur->func) {
1257 err("out of system memory\n"); 1256 err("out of system memory\n");
1258 rc = -ENOMEM; 1257 rc = -ENOMEM;
1259 goto error; 1258 goto error;
1260 } 1259 }
1261 memset(slot_cur->func, 0, sizeof(struct pci_func));
1262 slot_cur->func->busno = slot_cur->bus; 1260 slot_cur->func->busno = slot_cur->bus;
1263 slot_cur->func->device = slot_cur->device; 1261 slot_cur->func->device = slot_cur->device;
1264 } 1262 }
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index aea1187c73ad..ba12034c5d3a 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -72,13 +72,7 @@ static int ebda_rio_table (void);
72 72
73static struct ebda_hpc_list * __init alloc_ebda_hpc_list (void) 73static struct ebda_hpc_list * __init alloc_ebda_hpc_list (void)
74{ 74{
75 struct ebda_hpc_list *list; 75 return kzalloc(sizeof(struct ebda_hpc_list), GFP_KERNEL);
76
77 list = kmalloc (sizeof (struct ebda_hpc_list), GFP_KERNEL);
78 if (!list)
79 return NULL;
80 memset (list, 0, sizeof (*list));
81 return list;
82} 76}
83 77
84static struct controller *alloc_ebda_hpc (u32 slot_count, u32 bus_count) 78static struct controller *alloc_ebda_hpc (u32 slot_count, u32 bus_count)
@@ -87,21 +81,18 @@ static struct controller *alloc_ebda_hpc (u32 slot_count, u32 bus_count)
87 struct ebda_hpc_slot *slots; 81 struct ebda_hpc_slot *slots;
88 struct ebda_hpc_bus *buses; 82 struct ebda_hpc_bus *buses;
89 83
90 controller = kmalloc (sizeof (struct controller), GFP_KERNEL); 84 controller = kzalloc(sizeof(struct controller), GFP_KERNEL);
91 if (!controller) 85 if (!controller)
92 goto error; 86 goto error;
93 memset (controller, 0, sizeof (*controller));
94 87
95 slots = kmalloc (sizeof (struct ebda_hpc_slot) * slot_count, GFP_KERNEL); 88 slots = kcalloc(slot_count, sizeof(struct ebda_hpc_slot), GFP_KERNEL);
96 if (!slots) 89 if (!slots)
97 goto error_contr; 90 goto error_contr;
98 memset (slots, 0, sizeof (*slots) * slot_count);
99 controller->slots = slots; 91 controller->slots = slots;
100 92
101 buses = kmalloc (sizeof (struct ebda_hpc_bus) * bus_count, GFP_KERNEL); 93 buses = kcalloc(bus_count, sizeof(struct ebda_hpc_bus), GFP_KERNEL);
102 if (!buses) 94 if (!buses)
103 goto error_slots; 95 goto error_slots;
104 memset (buses, 0, sizeof (*buses) * bus_count);
105 controller->buses = buses; 96 controller->buses = buses;
106 97
107 return controller; 98 return controller;
@@ -122,24 +113,12 @@ static void free_ebda_hpc (struct controller *controller)
122 113
123static struct ebda_rsrc_list * __init alloc_ebda_rsrc_list (void) 114static struct ebda_rsrc_list * __init alloc_ebda_rsrc_list (void)
124{ 115{
125 struct ebda_rsrc_list *list; 116 return kzalloc(sizeof(struct ebda_rsrc_list), GFP_KERNEL);
126
127 list = kmalloc (sizeof (struct ebda_rsrc_list), GFP_KERNEL);
128 if (!list)
129 return NULL;
130 memset (list, 0, sizeof (*list));
131 return list;
132} 117}
133 118
134static struct ebda_pci_rsrc *alloc_ebda_pci_rsrc (void) 119static struct ebda_pci_rsrc *alloc_ebda_pci_rsrc (void)
135{ 120{
136 struct ebda_pci_rsrc *resource; 121 return kzalloc(sizeof(struct ebda_pci_rsrc), GFP_KERNEL);
137
138 resource = kmalloc (sizeof (struct ebda_pci_rsrc), GFP_KERNEL);
139 if (!resource)
140 return NULL;
141 memset (resource, 0, sizeof (*resource));
142 return resource;
143} 122}
144 123
145static void __init print_bus_info (void) 124static void __init print_bus_info (void)
@@ -390,10 +369,9 @@ int __init ibmphp_access_ebda (void)
390 debug ("now enter io table ---\n"); 369 debug ("now enter io table ---\n");
391 debug ("rio blk id: %x\n", blk_id); 370 debug ("rio blk id: %x\n", blk_id);
392 371
393 rio_table_ptr = kmalloc (sizeof (struct rio_table_hdr), GFP_KERNEL); 372 rio_table_ptr = kzalloc(sizeof(struct rio_table_hdr), GFP_KERNEL);
394 if (!rio_table_ptr) 373 if (!rio_table_ptr)
395 return -ENOMEM; 374 return -ENOMEM;
396 memset (rio_table_ptr, 0, sizeof (struct rio_table_hdr) );
397 rio_table_ptr->ver_num = readb (io_mem + offset); 375 rio_table_ptr->ver_num = readb (io_mem + offset);
398 rio_table_ptr->scal_count = readb (io_mem + offset + 1); 376 rio_table_ptr->scal_count = readb (io_mem + offset + 1);
399 rio_table_ptr->riodev_count = readb (io_mem + offset + 2); 377 rio_table_ptr->riodev_count = readb (io_mem + offset + 2);
@@ -445,10 +423,9 @@ static int __init ebda_rio_table (void)
445 423
446 // we do concern about rio details 424 // we do concern about rio details
447 for (i = 0; i < rio_table_ptr->riodev_count; i++) { 425 for (i = 0; i < rio_table_ptr->riodev_count; i++) {
448 rio_detail_ptr = kmalloc (sizeof (struct rio_detail), GFP_KERNEL); 426 rio_detail_ptr = kzalloc(sizeof(struct rio_detail), GFP_KERNEL);
449 if (!rio_detail_ptr) 427 if (!rio_detail_ptr)
450 return -ENOMEM; 428 return -ENOMEM;
451 memset (rio_detail_ptr, 0, sizeof (struct rio_detail));
452 rio_detail_ptr->rio_node_id = readb (io_mem + offset); 429 rio_detail_ptr->rio_node_id = readb (io_mem + offset);
453 rio_detail_ptr->bbar = readl (io_mem + offset + 1); 430 rio_detail_ptr->bbar = readl (io_mem + offset + 1);
454 rio_detail_ptr->rio_type = readb (io_mem + offset + 5); 431 rio_detail_ptr->rio_type = readb (io_mem + offset + 5);
@@ -503,10 +480,9 @@ static int __init combine_wpg_for_chassis (void)
503 rio_detail_ptr = list_entry (list_head_ptr, struct rio_detail, rio_detail_list); 480 rio_detail_ptr = list_entry (list_head_ptr, struct rio_detail, rio_detail_list);
504 opt_rio_ptr = search_opt_vg (rio_detail_ptr->chassis_num); 481 opt_rio_ptr = search_opt_vg (rio_detail_ptr->chassis_num);
505 if (!opt_rio_ptr) { 482 if (!opt_rio_ptr) {
506 opt_rio_ptr = (struct opt_rio *) kmalloc (sizeof (struct opt_rio), GFP_KERNEL); 483 opt_rio_ptr = kzalloc(sizeof(struct opt_rio), GFP_KERNEL);
507 if (!opt_rio_ptr) 484 if (!opt_rio_ptr)
508 return -ENOMEM; 485 return -ENOMEM;
509 memset (opt_rio_ptr, 0, sizeof (struct opt_rio));
510 opt_rio_ptr->rio_type = rio_detail_ptr->rio_type; 486 opt_rio_ptr->rio_type = rio_detail_ptr->rio_type;
511 opt_rio_ptr->chassis_num = rio_detail_ptr->chassis_num; 487 opt_rio_ptr->chassis_num = rio_detail_ptr->chassis_num;
512 opt_rio_ptr->first_slot_num = rio_detail_ptr->first_slot_num; 488 opt_rio_ptr->first_slot_num = rio_detail_ptr->first_slot_num;
@@ -546,10 +522,9 @@ static int combine_wpg_for_expansion (void)
546 rio_detail_ptr = list_entry (list_head_ptr, struct rio_detail, rio_detail_list); 522 rio_detail_ptr = list_entry (list_head_ptr, struct rio_detail, rio_detail_list);
547 opt_rio_lo_ptr = search_opt_lo (rio_detail_ptr->chassis_num); 523 opt_rio_lo_ptr = search_opt_lo (rio_detail_ptr->chassis_num);
548 if (!opt_rio_lo_ptr) { 524 if (!opt_rio_lo_ptr) {
549 opt_rio_lo_ptr = (struct opt_rio_lo *) kmalloc (sizeof (struct opt_rio_lo), GFP_KERNEL); 525 opt_rio_lo_ptr = kzalloc(sizeof(struct opt_rio_lo), GFP_KERNEL);
550 if (!opt_rio_lo_ptr) 526 if (!opt_rio_lo_ptr)
551 return -ENOMEM; 527 return -ENOMEM;
552 memset (opt_rio_lo_ptr, 0, sizeof (struct opt_rio_lo));
553 opt_rio_lo_ptr->rio_type = rio_detail_ptr->rio_type; 528 opt_rio_lo_ptr->rio_type = rio_detail_ptr->rio_type;
554 opt_rio_lo_ptr->chassis_num = rio_detail_ptr->chassis_num; 529 opt_rio_lo_ptr->chassis_num = rio_detail_ptr->chassis_num;
555 opt_rio_lo_ptr->first_slot_num = rio_detail_ptr->first_slot_num; 530 opt_rio_lo_ptr->first_slot_num = rio_detail_ptr->first_slot_num;
@@ -842,12 +817,11 @@ static int __init ebda_rsrc_controller (void)
842 817
843 bus_info_ptr2 = ibmphp_find_same_bus_num (slot_ptr->slot_bus_num); 818 bus_info_ptr2 = ibmphp_find_same_bus_num (slot_ptr->slot_bus_num);
844 if (!bus_info_ptr2) { 819 if (!bus_info_ptr2) {
845 bus_info_ptr1 = (struct bus_info *) kmalloc (sizeof (struct bus_info), GFP_KERNEL); 820 bus_info_ptr1 = kzalloc(sizeof(struct bus_info), GFP_KERNEL);
846 if (!bus_info_ptr1) { 821 if (!bus_info_ptr1) {
847 rc = -ENOMEM; 822 rc = -ENOMEM;
848 goto error_no_hp_slot; 823 goto error_no_hp_slot;
849 } 824 }
850 memset (bus_info_ptr1, 0, sizeof (struct bus_info));
851 bus_info_ptr1->slot_min = slot_ptr->slot_num; 825 bus_info_ptr1->slot_min = slot_ptr->slot_num;
852 bus_info_ptr1->slot_max = slot_ptr->slot_num; 826 bus_info_ptr1->slot_max = slot_ptr->slot_num;
853 bus_info_ptr1->slot_count += 1; 827 bus_info_ptr1->slot_count += 1;
@@ -946,19 +920,17 @@ static int __init ebda_rsrc_controller (void)
946 // register slots with hpc core as well as create linked list of ibm slot 920 // register slots with hpc core as well as create linked list of ibm slot
947 for (index = 0; index < hpc_ptr->slot_count; index++) { 921 for (index = 0; index < hpc_ptr->slot_count; index++) {
948 922
949 hp_slot_ptr = kmalloc(sizeof(*hp_slot_ptr), GFP_KERNEL); 923 hp_slot_ptr = kzalloc(sizeof(*hp_slot_ptr), GFP_KERNEL);
950 if (!hp_slot_ptr) { 924 if (!hp_slot_ptr) {
951 rc = -ENOMEM; 925 rc = -ENOMEM;
952 goto error_no_hp_slot; 926 goto error_no_hp_slot;
953 } 927 }
954 memset(hp_slot_ptr, 0, sizeof(*hp_slot_ptr));
955 928
956 hp_slot_ptr->info = kmalloc (sizeof(struct hotplug_slot_info), GFP_KERNEL); 929 hp_slot_ptr->info = kzalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
957 if (!hp_slot_ptr->info) { 930 if (!hp_slot_ptr->info) {
958 rc = -ENOMEM; 931 rc = -ENOMEM;
959 goto error_no_hp_info; 932 goto error_no_hp_info;
960 } 933 }
961 memset(hp_slot_ptr->info, 0, sizeof(struct hotplug_slot_info));
962 934
963 hp_slot_ptr->name = kmalloc(30, GFP_KERNEL); 935 hp_slot_ptr->name = kmalloc(30, GFP_KERNEL);
964 if (!hp_slot_ptr->name) { 936 if (!hp_slot_ptr->name) {
@@ -966,12 +938,11 @@ static int __init ebda_rsrc_controller (void)
966 goto error_no_hp_name; 938 goto error_no_hp_name;
967 } 939 }
968 940
969 tmp_slot = kmalloc(sizeof(*tmp_slot), GFP_KERNEL); 941 tmp_slot = kzalloc(sizeof(*tmp_slot), GFP_KERNEL);
970 if (!tmp_slot) { 942 if (!tmp_slot) {
971 rc = -ENOMEM; 943 rc = -ENOMEM;
972 goto error_no_slot; 944 goto error_no_slot;
973 } 945 }
974 memset(tmp_slot, 0, sizeof(*tmp_slot));
975 946
976 tmp_slot->flag = TRUE; 947 tmp_slot->flag = TRUE;
977 948
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
index 155133fe5c12..97753ddcd856 100644
--- a/drivers/pci/hotplug/ibmphp_pci.c
+++ b/drivers/pci/hotplug/ibmphp_pci.c
@@ -164,12 +164,11 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
164 cleanup_count = 6; 164 cleanup_count = 6;
165 goto error; 165 goto error;
166 } 166 }
167 newfunc = kmalloc(sizeof(*newfunc), GFP_KERNEL); 167 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL);
168 if (!newfunc) { 168 if (!newfunc) {
169 err ("out of system memory\n"); 169 err ("out of system memory\n");
170 return -ENOMEM; 170 return -ENOMEM;
171 } 171 }
172 memset (newfunc, 0, sizeof (struct pci_func));
173 newfunc->busno = cur_func->busno; 172 newfunc->busno = cur_func->busno;
174 newfunc->device = device; 173 newfunc->device = device;
175 cur_func->next = newfunc; 174 cur_func->next = newfunc;
@@ -203,12 +202,11 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
203 flag = FALSE; 202 flag = FALSE;
204 for (i = 0; i < 32; i++) { 203 for (i = 0; i < 32; i++) {
205 if (func->devices[i]) { 204 if (func->devices[i]) {
206 newfunc = kmalloc(sizeof(*newfunc), GFP_KERNEL); 205 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL);
207 if (!newfunc) { 206 if (!newfunc) {
208 err ("out of system memory\n"); 207 err ("out of system memory\n");
209 return -ENOMEM; 208 return -ENOMEM;
210 } 209 }
211 memset (newfunc, 0, sizeof (struct pci_func));
212 newfunc->busno = sec_number; 210 newfunc->busno = sec_number;
213 newfunc->device = (u8) i; 211 newfunc->device = (u8) i;
214 for (j = 0; j < 4; j++) 212 for (j = 0; j < 4; j++)
@@ -232,12 +230,11 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
232 } 230 }
233 } 231 }
234 232
235 newfunc = kmalloc(sizeof(*newfunc), GFP_KERNEL); 233 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL);
236 if (!newfunc) { 234 if (!newfunc) {
237 err ("out of system memory\n"); 235 err ("out of system memory\n");
238 return -ENOMEM; 236 return -ENOMEM;
239 } 237 }
240 memset (newfunc, 0, sizeof (struct pci_func));
241 newfunc->busno = cur_func->busno; 238 newfunc->busno = cur_func->busno;
242 newfunc->device = device; 239 newfunc->device = device;
243 for (j = 0; j < 4; j++) 240 for (j = 0; j < 4; j++)
@@ -279,12 +276,11 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
279 for (i = 0; i < 32; i++) { 276 for (i = 0; i < 32; i++) {
280 if (func->devices[i]) { 277 if (func->devices[i]) {
281 debug ("inside for loop, device is %x\n", i); 278 debug ("inside for loop, device is %x\n", i);
282 newfunc = kmalloc(sizeof(*newfunc), GFP_KERNEL); 279 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL);
283 if (!newfunc) { 280 if (!newfunc) {
284 err (" out of system memory\n"); 281 err (" out of system memory\n");
285 return -ENOMEM; 282 return -ENOMEM;
286 } 283 }
287 memset (newfunc, 0, sizeof (struct pci_func));
288 newfunc->busno = sec_number; 284 newfunc->busno = sec_number;
289 newfunc->device = (u8) i; 285 newfunc->device = (u8) i;
290 for (j = 0; j < 4; j++) 286 for (j = 0; j < 4; j++)
@@ -405,13 +401,12 @@ static int configure_device (struct pci_func *func)
405 401
406 debug ("len[count] in IO %x, count %d\n", len[count], count); 402 debug ("len[count] in IO %x, count %d\n", len[count], count);
407 403
408 io[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 404 io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
409 405
410 if (!io[count]) { 406 if (!io[count]) {
411 err ("out of system memory\n"); 407 err ("out of system memory\n");
412 return -ENOMEM; 408 return -ENOMEM;
413 } 409 }
414 memset (io[count], 0, sizeof (struct resource_node));
415 io[count]->type = IO; 410 io[count]->type = IO;
416 io[count]->busno = func->busno; 411 io[count]->busno = func->busno;
417 io[count]->devfunc = PCI_DEVFN(func->device, func->function); 412 io[count]->devfunc = PCI_DEVFN(func->device, func->function);
@@ -444,12 +439,11 @@ static int configure_device (struct pci_func *func)
444 439
445 debug ("len[count] in PFMEM %x, count %d\n", len[count], count); 440 debug ("len[count] in PFMEM %x, count %d\n", len[count], count);
446 441
447 pfmem[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 442 pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
448 if (!pfmem[count]) { 443 if (!pfmem[count]) {
449 err ("out of system memory\n"); 444 err ("out of system memory\n");
450 return -ENOMEM; 445 return -ENOMEM;
451 } 446 }
452 memset (pfmem[count], 0, sizeof (struct resource_node));
453 pfmem[count]->type = PFMEM; 447 pfmem[count]->type = PFMEM;
454 pfmem[count]->busno = func->busno; 448 pfmem[count]->busno = func->busno;
455 pfmem[count]->devfunc = PCI_DEVFN(func->device, 449 pfmem[count]->devfunc = PCI_DEVFN(func->device,
@@ -460,13 +454,12 @@ static int configure_device (struct pci_func *func)
460 ibmphp_add_resource (pfmem[count]); 454 ibmphp_add_resource (pfmem[count]);
461 func->pfmem[count] = pfmem[count]; 455 func->pfmem[count] = pfmem[count];
462 } else { 456 } else {
463 mem_tmp = kmalloc(sizeof(*mem_tmp), GFP_KERNEL); 457 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL);
464 if (!mem_tmp) { 458 if (!mem_tmp) {
465 err ("out of system memory\n"); 459 err ("out of system memory\n");
466 kfree (pfmem[count]); 460 kfree (pfmem[count]);
467 return -ENOMEM; 461 return -ENOMEM;
468 } 462 }
469 memset (mem_tmp, 0, sizeof (struct resource_node));
470 mem_tmp->type = MEM; 463 mem_tmp->type = MEM;
471 mem_tmp->busno = pfmem[count]->busno; 464 mem_tmp->busno = pfmem[count]->busno;
472 mem_tmp->devfunc = pfmem[count]->devfunc; 465 mem_tmp->devfunc = pfmem[count]->devfunc;
@@ -512,12 +505,11 @@ static int configure_device (struct pci_func *func)
512 505
513 debug ("len[count] in Mem %x, count %d\n", len[count], count); 506 debug ("len[count] in Mem %x, count %d\n", len[count], count);
514 507
515 mem[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 508 mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
516 if (!mem[count]) { 509 if (!mem[count]) {
517 err ("out of system memory\n"); 510 err ("out of system memory\n");
518 return -ENOMEM; 511 return -ENOMEM;
519 } 512 }
520 memset (mem[count], 0, sizeof (struct resource_node));
521 mem[count]->type = MEM; 513 mem[count]->type = MEM;
522 mem[count]->busno = func->busno; 514 mem[count]->busno = func->busno;
523 mem[count]->devfunc = PCI_DEVFN(func->device, 515 mem[count]->devfunc = PCI_DEVFN(func->device,
@@ -677,14 +669,13 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
677 669
678 debug ("len[count] in IO = %x\n", len[count]); 670 debug ("len[count] in IO = %x\n", len[count]);
679 671
680 bus_io[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 672 bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
681 673
682 if (!bus_io[count]) { 674 if (!bus_io[count]) {
683 err ("out of system memory\n"); 675 err ("out of system memory\n");
684 retval = -ENOMEM; 676 retval = -ENOMEM;
685 goto error; 677 goto error;
686 } 678 }
687 memset (bus_io[count], 0, sizeof (struct resource_node));
688 bus_io[count]->type = IO; 679 bus_io[count]->type = IO;
689 bus_io[count]->busno = func->busno; 680 bus_io[count]->busno = func->busno;
690 bus_io[count]->devfunc = PCI_DEVFN(func->device, 681 bus_io[count]->devfunc = PCI_DEVFN(func->device,
@@ -711,13 +702,12 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
711 702
712 debug ("len[count] in PFMEM = %x\n", len[count]); 703 debug ("len[count] in PFMEM = %x\n", len[count]);
713 704
714 bus_pfmem[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 705 bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
715 if (!bus_pfmem[count]) { 706 if (!bus_pfmem[count]) {
716 err ("out of system memory\n"); 707 err ("out of system memory\n");
717 retval = -ENOMEM; 708 retval = -ENOMEM;
718 goto error; 709 goto error;
719 } 710 }
720 memset (bus_pfmem[count], 0, sizeof (struct resource_node));
721 bus_pfmem[count]->type = PFMEM; 711 bus_pfmem[count]->type = PFMEM;
722 bus_pfmem[count]->busno = func->busno; 712 bus_pfmem[count]->busno = func->busno;
723 bus_pfmem[count]->devfunc = PCI_DEVFN(func->device, 713 bus_pfmem[count]->devfunc = PCI_DEVFN(func->device,
@@ -728,13 +718,12 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
728 ibmphp_add_resource (bus_pfmem[count]); 718 ibmphp_add_resource (bus_pfmem[count]);
729 func->pfmem[count] = bus_pfmem[count]; 719 func->pfmem[count] = bus_pfmem[count];
730 } else { 720 } else {
731 mem_tmp = kmalloc(sizeof(*mem_tmp), GFP_KERNEL); 721 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL);
732 if (!mem_tmp) { 722 if (!mem_tmp) {
733 err ("out of system memory\n"); 723 err ("out of system memory\n");
734 retval = -ENOMEM; 724 retval = -ENOMEM;
735 goto error; 725 goto error;
736 } 726 }
737 memset (mem_tmp, 0, sizeof (struct resource_node));
738 mem_tmp->type = MEM; 727 mem_tmp->type = MEM;
739 mem_tmp->busno = bus_pfmem[count]->busno; 728 mem_tmp->busno = bus_pfmem[count]->busno;
740 mem_tmp->devfunc = bus_pfmem[count]->devfunc; 729 mem_tmp->devfunc = bus_pfmem[count]->devfunc;
@@ -770,13 +759,12 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
770 759
771 debug ("len[count] in Memory is %x\n", len[count]); 760 debug ("len[count] in Memory is %x\n", len[count]);
772 761
773 bus_mem[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 762 bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
774 if (!bus_mem[count]) { 763 if (!bus_mem[count]) {
775 err ("out of system memory\n"); 764 err ("out of system memory\n");
776 retval = -ENOMEM; 765 retval = -ENOMEM;
777 goto error; 766 goto error;
778 } 767 }
779 memset (bus_mem[count], 0, sizeof (struct resource_node));
780 bus_mem[count]->type = MEM; 768 bus_mem[count]->type = MEM;
781 bus_mem[count]->busno = func->busno; 769 bus_mem[count]->busno = func->busno;
782 bus_mem[count]->devfunc = PCI_DEVFN(func->device, 770 bus_mem[count]->devfunc = PCI_DEVFN(func->device,
@@ -841,14 +829,13 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
841 flag_io = TRUE; 829 flag_io = TRUE;
842 } else { 830 } else {
843 debug ("it wants %x IO behind the bridge\n", amount_needed->io); 831 debug ("it wants %x IO behind the bridge\n", amount_needed->io);
844 io = kmalloc(sizeof(*io), GFP_KERNEL); 832 io = kzalloc(sizeof(*io), GFP_KERNEL);
845 833
846 if (!io) { 834 if (!io) {
847 err ("out of system memory\n"); 835 err ("out of system memory\n");
848 retval = -ENOMEM; 836 retval = -ENOMEM;
849 goto error; 837 goto error;
850 } 838 }
851 memset (io, 0, sizeof (struct resource_node));
852 io->type = IO; 839 io->type = IO;
853 io->busno = func->busno; 840 io->busno = func->busno;
854 io->devfunc = PCI_DEVFN(func->device, func->function); 841 io->devfunc = PCI_DEVFN(func->device, func->function);
@@ -865,13 +852,12 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
865 flag_mem = TRUE; 852 flag_mem = TRUE;
866 } else { 853 } else {
867 debug ("it wants %x memory behind the bridge\n", amount_needed->mem); 854 debug ("it wants %x memory behind the bridge\n", amount_needed->mem);
868 mem = kmalloc(sizeof(*mem), GFP_KERNEL); 855 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
869 if (!mem) { 856 if (!mem) {
870 err ("out of system memory\n"); 857 err ("out of system memory\n");
871 retval = -ENOMEM; 858 retval = -ENOMEM;
872 goto error; 859 goto error;
873 } 860 }
874 memset (mem, 0, sizeof (struct resource_node));
875 mem->type = MEM; 861 mem->type = MEM;
876 mem->busno = func->busno; 862 mem->busno = func->busno;
877 mem->devfunc = PCI_DEVFN(func->device, func->function); 863 mem->devfunc = PCI_DEVFN(func->device, func->function);
@@ -888,13 +874,12 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
888 flag_pfmem = TRUE; 874 flag_pfmem = TRUE;
889 } else { 875 } else {
890 debug ("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem); 876 debug ("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem);
891 pfmem = kmalloc(sizeof(*pfmem), GFP_KERNEL); 877 pfmem = kzalloc(sizeof(*pfmem), GFP_KERNEL);
892 if (!pfmem) { 878 if (!pfmem) {
893 err ("out of system memory\n"); 879 err ("out of system memory\n");
894 retval = -ENOMEM; 880 retval = -ENOMEM;
895 goto error; 881 goto error;
896 } 882 }
897 memset (pfmem, 0, sizeof (struct resource_node));
898 pfmem->type = PFMEM; 883 pfmem->type = PFMEM;
899 pfmem->busno = func->busno; 884 pfmem->busno = func->busno;
900 pfmem->devfunc = PCI_DEVFN(func->device, func->function); 885 pfmem->devfunc = PCI_DEVFN(func->device, func->function);
@@ -904,13 +889,12 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
904 ibmphp_add_resource (pfmem); 889 ibmphp_add_resource (pfmem);
905 flag_pfmem = TRUE; 890 flag_pfmem = TRUE;
906 } else { 891 } else {
907 mem_tmp = kmalloc(sizeof(*mem_tmp), GFP_KERNEL); 892 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL);
908 if (!mem_tmp) { 893 if (!mem_tmp) {
909 err ("out of system memory\n"); 894 err ("out of system memory\n");
910 retval = -ENOMEM; 895 retval = -ENOMEM;
911 goto error; 896 goto error;
912 } 897 }
913 memset (mem_tmp, 0, sizeof (struct resource_node));
914 mem_tmp->type = MEM; 898 mem_tmp->type = MEM;
915 mem_tmp->busno = pfmem->busno; 899 mem_tmp->busno = pfmem->busno;
916 mem_tmp->devfunc = pfmem->devfunc; 900 mem_tmp->devfunc = pfmem->devfunc;
@@ -936,13 +920,12 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
936 */ 920 */
937 bus = ibmphp_find_res_bus (sec_number); 921 bus = ibmphp_find_res_bus (sec_number);
938 if (!bus) { 922 if (!bus) {
939 bus = kmalloc(sizeof(*bus), GFP_KERNEL); 923 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
940 if (!bus) { 924 if (!bus) {
941 err ("out of system memory\n"); 925 err ("out of system memory\n");
942 retval = -ENOMEM; 926 retval = -ENOMEM;
943 goto error; 927 goto error;
944 } 928 }
945 memset (bus, 0, sizeof (struct bus_node));
946 bus->busno = sec_number; 929 bus->busno = sec_number;
947 debug ("b4 adding new bus\n"); 930 debug ("b4 adding new bus\n");
948 rc = add_new_bus (bus, io, mem, pfmem, func->busno); 931 rc = add_new_bus (bus, io, mem, pfmem, func->busno);
@@ -1111,10 +1094,9 @@ static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno)
1111 }; 1094 };
1112 struct res_needed *amount; 1095 struct res_needed *amount;
1113 1096
1114 amount = kmalloc(sizeof(*amount), GFP_KERNEL); 1097 amount = kzalloc(sizeof(*amount), GFP_KERNEL);
1115 if (amount == NULL) 1098 if (amount == NULL)
1116 return NULL; 1099 return NULL;
1117 memset (amount, 0, sizeof (struct res_needed));
1118 1100
1119 ibmphp_pci_bus->number = busno; 1101 ibmphp_pci_bus->number = busno;
1120 1102
@@ -1672,12 +1654,11 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r
1672 list_add (&bus->bus_list, &cur_bus->bus_list); 1654 list_add (&bus->bus_list, &cur_bus->bus_list);
1673 } 1655 }
1674 if (io) { 1656 if (io) {
1675 io_range = kmalloc(sizeof(*io_range), GFP_KERNEL); 1657 io_range = kzalloc(sizeof(*io_range), GFP_KERNEL);
1676 if (!io_range) { 1658 if (!io_range) {
1677 err ("out of system memory\n"); 1659 err ("out of system memory\n");
1678 return -ENOMEM; 1660 return -ENOMEM;
1679 } 1661 }
1680 memset (io_range, 0, sizeof (struct range_node));
1681 io_range->start = io->start; 1662 io_range->start = io->start;
1682 io_range->end = io->end; 1663 io_range->end = io->end;
1683 io_range->rangeno = 1; 1664 io_range->rangeno = 1;
@@ -1685,12 +1666,11 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r
1685 bus->rangeIO = io_range; 1666 bus->rangeIO = io_range;
1686 } 1667 }
1687 if (mem) { 1668 if (mem) {
1688 mem_range = kmalloc(sizeof(*mem_range), GFP_KERNEL); 1669 mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL);
1689 if (!mem_range) { 1670 if (!mem_range) {
1690 err ("out of system memory\n"); 1671 err ("out of system memory\n");
1691 return -ENOMEM; 1672 return -ENOMEM;
1692 } 1673 }
1693 memset (mem_range, 0, sizeof (struct range_node));
1694 mem_range->start = mem->start; 1674 mem_range->start = mem->start;
1695 mem_range->end = mem->end; 1675 mem_range->end = mem->end;
1696 mem_range->rangeno = 1; 1676 mem_range->rangeno = 1;
@@ -1698,12 +1678,11 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r
1698 bus->rangeMem = mem_range; 1678 bus->rangeMem = mem_range;
1699 } 1679 }
1700 if (pfmem) { 1680 if (pfmem) {
1701 pfmem_range = kmalloc(sizeof(*pfmem_range), GFP_KERNEL); 1681 pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL);
1702 if (!pfmem_range) { 1682 if (!pfmem_range) {
1703 err ("out of system memory\n"); 1683 err ("out of system memory\n");
1704 return -ENOMEM; 1684 return -ENOMEM;
1705 } 1685 }
1706 memset (pfmem_range, 0, sizeof (struct range_node));
1707 pfmem_range->start = pfmem->start; 1686 pfmem_range->start = pfmem->start;
1708 pfmem_range->end = pfmem->end; 1687 pfmem_range->end = pfmem->end;
1709 pfmem_range->rangeno = 1; 1688 pfmem_range->rangeno = 1;
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
index 9c224c94d698..852a98bf07d3 100644
--- a/drivers/pci/hotplug/ibmphp_res.c
+++ b/drivers/pci/hotplug/ibmphp_res.c
@@ -55,13 +55,12 @@ static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8
55 return NULL; 55 return NULL;
56 } 56 }
57 57
58 newbus = kmalloc (sizeof (struct bus_node), GFP_KERNEL); 58 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL);
59 if (!newbus) { 59 if (!newbus) {
60 err ("out of system memory\n"); 60 err ("out of system memory\n");
61 return NULL; 61 return NULL;
62 } 62 }
63 63
64 memset (newbus, 0, sizeof (struct bus_node));
65 if (flag) 64 if (flag)
66 newbus->busno = busno; 65 newbus->busno = busno;
67 else 66 else
@@ -79,12 +78,11 @@ static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc * cur
79 return NULL; 78 return NULL;
80 } 79 }
81 80
82 rs = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 81 rs = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
83 if (!rs) { 82 if (!rs) {
84 err ("out of system memory\n"); 83 err ("out of system memory\n");
85 return NULL; 84 return NULL;
86 } 85 }
87 memset (rs, 0, sizeof (struct resource_node));
88 rs->busno = curr->bus_num; 86 rs->busno = curr->bus_num;
89 rs->devfunc = curr->dev_fun; 87 rs->devfunc = curr->dev_fun;
90 rs->start = curr->start_addr; 88 rs->start = curr->start_addr;
@@ -100,12 +98,11 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node
100 u8 num_ranges = 0; 98 u8 num_ranges = 0;
101 99
102 if (first_bus) { 100 if (first_bus) {
103 newbus = kmalloc (sizeof (struct bus_node), GFP_KERNEL); 101 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL);
104 if (!newbus) { 102 if (!newbus) {
105 err ("out of system memory.\n"); 103 err ("out of system memory.\n");
106 return -ENOMEM; 104 return -ENOMEM;
107 } 105 }
108 memset (newbus, 0, sizeof (struct bus_node));
109 newbus->busno = curr->bus_num; 106 newbus->busno = curr->bus_num;
110 } else { 107 } else {
111 newbus = *new_bus; 108 newbus = *new_bus;
@@ -122,14 +119,13 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node
122 } 119 }
123 } 120 }
124 121
125 newrange = kmalloc (sizeof (struct range_node), GFP_KERNEL); 122 newrange = kzalloc(sizeof(struct range_node), GFP_KERNEL);
126 if (!newrange) { 123 if (!newrange) {
127 if (first_bus) 124 if (first_bus)
128 kfree (newbus); 125 kfree (newbus);
129 err ("out of system memory\n"); 126 err ("out of system memory\n");
130 return -ENOMEM; 127 return -ENOMEM;
131 } 128 }
132 memset (newrange, 0, sizeof (struct range_node));
133 newrange->start = curr->start_addr; 129 newrange->start = curr->start_addr;
134 newrange->end = curr->end_addr; 130 newrange->end = curr->end_addr;
135 131
@@ -1705,12 +1701,11 @@ static int __init once_over (void)
1705 1701
1706 bus_cur->firstPFMemFromMem = pfmem_cur; 1702 bus_cur->firstPFMemFromMem = pfmem_cur;
1707 1703
1708 mem = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 1704 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
1709 if (!mem) { 1705 if (!mem) {
1710 err ("out of system memory\n"); 1706 err ("out of system memory\n");
1711 return -ENOMEM; 1707 return -ENOMEM;
1712 } 1708 }
1713 memset (mem, 0, sizeof (struct resource_node));
1714 mem->type = MEM; 1709 mem->type = MEM;
1715 mem->busno = pfmem_cur->busno; 1710 mem->busno = pfmem_cur->busno;
1716 mem->devfunc = pfmem_cur->devfunc; 1711 mem->devfunc = pfmem_cur->devfunc;
@@ -1994,12 +1989,11 @@ static int __init update_bridge_ranges (struct bus_node **bus)
1994 end_address |= (upper_io_end << 16); 1989 end_address |= (upper_io_end << 16);
1995 1990
1996 if ((start_address) && (start_address <= end_address)) { 1991 if ((start_address) && (start_address <= end_address)) {
1997 range = kmalloc (sizeof (struct range_node), GFP_KERNEL); 1992 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
1998 if (!range) { 1993 if (!range) {
1999 err ("out of system memory\n"); 1994 err ("out of system memory\n");
2000 return -ENOMEM; 1995 return -ENOMEM;
2001 } 1996 }
2002 memset (range, 0, sizeof (struct range_node));
2003 range->start = start_address; 1997 range->start = start_address;
2004 range->end = end_address + 0xfff; 1998 range->end = end_address + 0xfff;
2005 1999
@@ -2020,13 +2014,12 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2020 fix_resources (bus_sec); 2014 fix_resources (bus_sec);
2021 2015
2022 if (ibmphp_find_resource (bus_cur, start_address, &io, IO)) { 2016 if (ibmphp_find_resource (bus_cur, start_address, &io, IO)) {
2023 io = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 2017 io = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2024 if (!io) { 2018 if (!io) {
2025 kfree (range); 2019 kfree (range);
2026 err ("out of system memory\n"); 2020 err ("out of system memory\n");
2027 return -ENOMEM; 2021 return -ENOMEM;
2028 } 2022 }
2029 memset (io, 0, sizeof (struct resource_node));
2030 io->type = IO; 2023 io->type = IO;
2031 io->busno = bus_cur->busno; 2024 io->busno = bus_cur->busno;
2032 io->devfunc = ((device << 3) | (function & 0x7)); 2025 io->devfunc = ((device << 3) | (function & 0x7));
@@ -2045,12 +2038,11 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2045 2038
2046 if ((start_address) && (start_address <= end_address)) { 2039 if ((start_address) && (start_address <= end_address)) {
2047 2040
2048 range = kmalloc (sizeof (struct range_node), GFP_KERNEL); 2041 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
2049 if (!range) { 2042 if (!range) {
2050 err ("out of system memory\n"); 2043 err ("out of system memory\n");
2051 return -ENOMEM; 2044 return -ENOMEM;
2052 } 2045 }
2053 memset (range, 0, sizeof (struct range_node));
2054 range->start = start_address; 2046 range->start = start_address;
2055 range->end = end_address + 0xfffff; 2047 range->end = end_address + 0xfffff;
2056 2048
@@ -2072,13 +2064,12 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2072 fix_resources (bus_sec); 2064 fix_resources (bus_sec);
2073 2065
2074 if (ibmphp_find_resource (bus_cur, start_address, &mem, MEM)) { 2066 if (ibmphp_find_resource (bus_cur, start_address, &mem, MEM)) {
2075 mem = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 2067 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2076 if (!mem) { 2068 if (!mem) {
2077 kfree (range); 2069 kfree (range);
2078 err ("out of system memory\n"); 2070 err ("out of system memory\n");
2079 return -ENOMEM; 2071 return -ENOMEM;
2080 } 2072 }
2081 memset (mem, 0, sizeof (struct resource_node));
2082 mem->type = MEM; 2073 mem->type = MEM;
2083 mem->busno = bus_cur->busno; 2074 mem->busno = bus_cur->busno;
2084 mem->devfunc = ((device << 3) | (function & 0x7)); 2075 mem->devfunc = ((device << 3) | (function & 0x7));
@@ -2101,12 +2092,11 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2101 2092
2102 if ((start_address) && (start_address <= end_address)) { 2093 if ((start_address) && (start_address <= end_address)) {
2103 2094
2104 range = kmalloc (sizeof (struct range_node), GFP_KERNEL); 2095 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
2105 if (!range) { 2096 if (!range) {
2106 err ("out of system memory\n"); 2097 err ("out of system memory\n");
2107 return -ENOMEM; 2098 return -ENOMEM;
2108 } 2099 }
2109 memset (range, 0, sizeof (struct range_node));
2110 range->start = start_address; 2100 range->start = start_address;
2111 range->end = end_address + 0xfffff; 2101 range->end = end_address + 0xfffff;
2112 2102
@@ -2127,13 +2117,12 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2127 2117
2128 fix_resources (bus_sec); 2118 fix_resources (bus_sec);
2129 if (ibmphp_find_resource (bus_cur, start_address, &pfmem, PFMEM)) { 2119 if (ibmphp_find_resource (bus_cur, start_address, &pfmem, PFMEM)) {
2130 pfmem = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 2120 pfmem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2131 if (!pfmem) { 2121 if (!pfmem) {
2132 kfree (range); 2122 kfree (range);
2133 err ("out of system memory\n"); 2123 err ("out of system memory\n");
2134 return -ENOMEM; 2124 return -ENOMEM;
2135 } 2125 }
2136 memset (pfmem, 0, sizeof (struct resource_node));
2137 pfmem->type = PFMEM; 2126 pfmem->type = PFMEM;
2138 pfmem->busno = bus_cur->busno; 2127 pfmem->busno = bus_cur->busno;
2139 pfmem->devfunc = ((device << 3) | (function & 0x7)); 2128 pfmem->devfunc = ((device << 3) | (function & 0x7));
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 1e8506e0fd87..601cf9045b20 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -117,27 +117,23 @@ static int init_slots(struct controller *ctrl)
117 slot_number = ctrl->first_slot; 117 slot_number = ctrl->first_slot;
118 118
119 while (number_of_slots) { 119 while (number_of_slots) {
120 slot = kmalloc(sizeof(*slot), GFP_KERNEL); 120 slot = kzalloc(sizeof(*slot), GFP_KERNEL);
121 if (!slot) 121 if (!slot)
122 goto error; 122 goto error;
123 123
124 memset(slot, 0, sizeof(struct slot));
125 slot->hotplug_slot = 124 slot->hotplug_slot =
126 kmalloc(sizeof(*(slot->hotplug_slot)), 125 kzalloc(sizeof(*(slot->hotplug_slot)),
127 GFP_KERNEL); 126 GFP_KERNEL);
128 if (!slot->hotplug_slot) 127 if (!slot->hotplug_slot)
129 goto error_slot; 128 goto error_slot;
130 hotplug_slot = slot->hotplug_slot; 129 hotplug_slot = slot->hotplug_slot;
131 memset(hotplug_slot, 0, sizeof(struct hotplug_slot));
132 130
133 hotplug_slot->info = 131 hotplug_slot->info =
134 kmalloc(sizeof(*(hotplug_slot->info)), 132 kzalloc(sizeof(*(hotplug_slot->info)),
135 GFP_KERNEL); 133 GFP_KERNEL);
136 if (!hotplug_slot->info) 134 if (!hotplug_slot->info)
137 goto error_hpslot; 135 goto error_hpslot;
138 hotplug_slot_info = hotplug_slot->info; 136 hotplug_slot_info = hotplug_slot->info;
139 memset(hotplug_slot_info, 0,
140 sizeof(struct hotplug_slot_info));
141 hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); 137 hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
142 if (!hotplug_slot->name) 138 if (!hotplug_slot->name)
143 goto error_info; 139 goto error_info;
@@ -373,12 +369,11 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
373 u8 value; 369 u8 value;
374 struct pci_dev *pdev; 370 struct pci_dev *pdev;
375 371
376 ctrl = kmalloc(sizeof(*ctrl), GFP_KERNEL); 372 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
377 if (!ctrl) { 373 if (!ctrl) {
378 err("%s : out of memory\n", __FUNCTION__); 374 err("%s : out of memory\n", __FUNCTION__);
379 goto err_out_none; 375 goto err_out_none;
380 } 376 }
381 memset(ctrl, 0, sizeof(struct controller));
382 377
383 pdev = dev->port; 378 pdev = dev->port;
384 ctrl->pci_dev = pdev; 379 ctrl->pci_dev = pdev;
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index 78943e064b59..b771196a654e 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -84,19 +84,16 @@ struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_
84{ 84{
85 struct slot *slot; 85 struct slot *slot;
86 86
87 slot = kmalloc(sizeof (struct slot), GFP_KERNEL); 87 slot = kzalloc(sizeof(struct slot), GFP_KERNEL);
88 if (!slot) 88 if (!slot)
89 goto error_nomem; 89 goto error_nomem;
90 memset(slot, 0, sizeof (struct slot)); 90 slot->hotplug_slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
91 slot->hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
92 if (!slot->hotplug_slot) 91 if (!slot->hotplug_slot)
93 goto error_slot; 92 goto error_slot;
94 memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot)); 93 slot->hotplug_slot->info = kzalloc(sizeof(struct hotplug_slot_info),
95 slot->hotplug_slot->info = kmalloc(sizeof (struct hotplug_slot_info),
96 GFP_KERNEL); 94 GFP_KERNEL);
97 if (!slot->hotplug_slot->info) 95 if (!slot->hotplug_slot->info)
98 goto error_hpslot; 96 goto error_hpslot;
99 memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info));
100 slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL); 97 slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL);
101 if (!slot->hotplug_slot->name) 98 if (!slot->hotplug_slot->name)
102 goto error_info; 99 goto error_info;
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index eb5b50c8770c..f22f69ac6445 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -53,11 +53,10 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
53 if (fields < 0) 53 if (fields < 0)
54 return -EINVAL; 54 return -EINVAL;
55 55
56 dynid = kmalloc(sizeof(*dynid), GFP_KERNEL); 56 dynid = kzalloc(sizeof(*dynid), GFP_KERNEL);
57 if (!dynid) 57 if (!dynid)
58 return -ENOMEM; 58 return -ENOMEM;
59 59
60 memset(dynid, 0, sizeof(*dynid));
61 INIT_LIST_HEAD(&dynid->node); 60 INIT_LIST_HEAD(&dynid->node);
62 dynid->id.vendor = vendor; 61 dynid->id.vendor = vendor;
63 dynid->id.device = device; 62 dynid->id.device = device;
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 965a5934623a..56ac2bc003c7 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -501,9 +501,8 @@ int pci_create_sysfs_dev_files (struct pci_dev *pdev)
501 if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) { 501 if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) {
502 struct bin_attribute *rom_attr; 502 struct bin_attribute *rom_attr;
503 503
504 rom_attr = kmalloc(sizeof(*rom_attr), GFP_ATOMIC); 504 rom_attr = kzalloc(sizeof(*rom_attr), GFP_ATOMIC);
505 if (rom_attr) { 505 if (rom_attr) {
506 memset(rom_attr, 0x00, sizeof(*rom_attr));
507 pdev->rom_attr = rom_attr; 506 pdev->rom_attr = rom_attr;
508 rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE); 507 rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
509 rom_attr->attr.name = "rom"; 508 rom_attr->attr.name = "rom";
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index e4e5f1e8d816..55c662267868 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -248,11 +248,10 @@ static struct pcie_device* alloc_pcie_device(struct pci_dev *parent,
248{ 248{
249 struct pcie_device *device; 249 struct pcie_device *device;
250 250
251 device = kmalloc(sizeof(struct pcie_device), GFP_KERNEL); 251 device = kzalloc(sizeof(struct pcie_device), GFP_KERNEL);
252 if (!device) 252 if (!device)
253 return NULL; 253 return NULL;
254 254
255 memset(device, 0, sizeof(struct pcie_device));
256 pcie_device_init(parent, device, port_type, service_type, irq,irq_mode); 255 pcie_device_init(parent, device, port_type, service_type, irq,irq_mode);
257 printk(KERN_DEBUG "Allocate Port Service[%s]\n", device->device.bus_id); 256 printk(KERN_DEBUG "Allocate Port Service[%s]\n", device->device.bus_id);
258 return device; 257 return device;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e3dc3063e05b..a10ed9dab2c2 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -33,10 +33,9 @@ LIST_HEAD(pci_devices);
33 */ 33 */
34static void pci_create_legacy_files(struct pci_bus *b) 34static void pci_create_legacy_files(struct pci_bus *b)
35{ 35{
36 b->legacy_io = kmalloc(sizeof(struct bin_attribute) * 2, 36 b->legacy_io = kzalloc(sizeof(struct bin_attribute) * 2,
37 GFP_ATOMIC); 37 GFP_ATOMIC);
38 if (b->legacy_io) { 38 if (b->legacy_io) {
39 memset(b->legacy_io, 0, sizeof(struct bin_attribute) * 2);
40 b->legacy_io->attr.name = "legacy_io"; 39 b->legacy_io->attr.name = "legacy_io";
41 b->legacy_io->size = 0xffff; 40 b->legacy_io->size = 0xffff;
42 b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; 41 b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;
@@ -320,9 +319,8 @@ static struct pci_bus * __devinit pci_alloc_bus(void)
320{ 319{
321 struct pci_bus *b; 320 struct pci_bus *b;
322 321
323 b = kmalloc(sizeof(*b), GFP_KERNEL); 322 b = kzalloc(sizeof(*b), GFP_KERNEL);
324 if (b) { 323 if (b) {
325 memset(b, 0, sizeof(*b));
326 INIT_LIST_HEAD(&b->node); 324 INIT_LIST_HEAD(&b->node);
327 INIT_LIST_HEAD(&b->children); 325 INIT_LIST_HEAD(&b->children);
328 INIT_LIST_HEAD(&b->devices); 326 INIT_LIST_HEAD(&b->devices);
@@ -797,11 +795,10 @@ pci_scan_device(struct pci_bus *bus, int devfn)
797 if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type)) 795 if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type))
798 return NULL; 796 return NULL;
799 797
800 dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); 798 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
801 if (!dev) 799 if (!dev)
802 return NULL; 800 return NULL;
803 801
804 memset(dev, 0, sizeof(struct pci_dev));
805 dev->bus = bus; 802 dev->bus = bus;
806 dev->sysdata = bus->sysdata; 803 dev->sysdata = bus->sysdata;
807 dev->dev.parent = bus->bridge; 804 dev->dev.parent = bus->bridge;