Commit 7e4bbaf0 authored by Gavin Shan's avatar Gavin Shan Committed by Benjamin Herrenschmidt

powerpc/eeh: Use slab to allocate eeh devices

The EEH initialization functions have been postponed until slab/slub
are ready. So we use slab/slub to allocate the memory chunks for newly
creatd EEH devices. That would save lots of memory.

The patch also does cleanup to replace "kmalloc" with "kzalloc" so
that we needn't clear the allocated memory chunk explicitly.
Signed-off-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 35e5cfe2
...@@ -151,7 +151,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, ...@@ -151,7 +151,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
return piar; return piar;
} }
} }
piar = kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); piar = kzalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC);
if (!piar) if (!piar)
return NULL; return NULL;
......
...@@ -55,7 +55,7 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data) ...@@ -55,7 +55,7 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
struct eeh_dev *edev; struct eeh_dev *edev;
/* Allocate EEH device */ /* Allocate EEH device */
edev = zalloc_maybe_bootmem(sizeof(*edev), GFP_KERNEL); edev = kzalloc(sizeof(*edev), GFP_KERNEL);
if (!edev) { if (!edev) {
pr_warning("%s: out of memory\n", __func__); pr_warning("%s: out of memory\n", __func__);
return NULL; return NULL;
......
...@@ -139,7 +139,7 @@ int eeh_send_failure_event(struct eeh_dev *edev) ...@@ -139,7 +139,7 @@ int eeh_send_failure_event(struct eeh_dev *edev)
printk(KERN_ERR "EEH: PCI location = %s\n", location); printk(KERN_ERR "EEH: PCI location = %s\n", location);
return 1; return 1;
} }
event = kmalloc(sizeof(*event), GFP_ATOMIC); event = kzalloc(sizeof(*event), GFP_ATOMIC);
if (event == NULL) { if (event == NULL) {
printk(KERN_ERR "EEH: out of memory, event not handled\n"); printk(KERN_ERR "EEH: out of memory, event not handled\n");
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment