Commit f8485350 authored by Yan Burman's avatar Yan Burman Committed by Paul Mackerras

[POWERPC] Replace kmalloc+memset with kzalloc

Replace kmalloc+memset with kzalloc.
Signed-off-by: default avatarYan Burman <burman.yan@gmail.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 04d76b93
...@@ -214,11 +214,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node( ...@@ -214,11 +214,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
return NULL; return NULL;
} }
dev = kmalloc(sizeof(struct ibmebus_dev), GFP_KERNEL); dev = kzalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
if (!dev) { if (!dev) {
return NULL; return NULL;
} }
memset(dev, 0, sizeof(struct ibmebus_dev));
dev->ofdev.node = of_node_get(dn); dev->ofdev.node = of_node_get(dn);
......
...@@ -330,7 +330,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, ...@@ -330,7 +330,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
struct pci_dev *dev; struct pci_dev *dev;
const char *type; const char *type;
dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
if (!dev) if (!dev)
return NULL; return NULL;
type = get_property(node, "device_type", NULL); type = get_property(node, "device_type", NULL);
...@@ -339,7 +339,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, ...@@ -339,7 +339,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
DBG(" create device, devfn: %x, type: %s\n", devfn, type); DBG(" create device, devfn: %x, type: %s\n", devfn, type);
memset(dev, 0, sizeof(struct pci_dev));
dev->bus = bus; dev->bus = bus;
dev->sysdata = node; dev->sysdata = node;
dev->dev.parent = bus->bridge; dev->dev.parent = bus->bridge;
......
...@@ -681,14 +681,12 @@ static int initialize_flash_pde_data(const char *rtas_call_name, ...@@ -681,14 +681,12 @@ static int initialize_flash_pde_data(const char *rtas_call_name,
int *status; int *status;
int token; int token;
dp->data = kmalloc(buf_size, GFP_KERNEL); dp->data = kzalloc(buf_size, GFP_KERNEL);
if (dp->data == NULL) { if (dp->data == NULL) {
remove_flash_pde(dp); remove_flash_pde(dp);
return -ENOMEM; return -ENOMEM;
} }
memset(dp->data, 0, buf_size);
/* /*
* This code assumes that the status int is the first member of the * This code assumes that the status int is the first member of the
* struct * struct
......
...@@ -116,8 +116,7 @@ void __devinit smp_generic_give_timebase(void) ...@@ -116,8 +116,7 @@ void __devinit smp_generic_give_timebase(void)
printk("Synchronizing timebase\n"); printk("Synchronizing timebase\n");
/* if this fails then this kernel won't work anyway... */ /* if this fails then this kernel won't work anyway... */
tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL ); tbsync = kzalloc( sizeof(*tbsync), GFP_KERNEL );
memset( tbsync, 0, sizeof(*tbsync) );
mb(); mb();
running = 1; running = 1;
......
...@@ -115,12 +115,10 @@ void iommu_table_getparms_iSeries(unsigned long busno, ...@@ -115,12 +115,10 @@ void iommu_table_getparms_iSeries(unsigned long busno,
{ {
struct iommu_table_cb *parms; struct iommu_table_cb *parms;
parms = kmalloc(sizeof(*parms), GFP_KERNEL); parms = kzalloc(sizeof(*parms), GFP_KERNEL);
if (parms == NULL) if (parms == NULL)
panic("PCI_DMA: TCE Table Allocation failed."); panic("PCI_DMA: TCE Table Allocation failed.");
memset(parms, 0, sizeof(*parms));
parms->itc_busno = busno; parms->itc_busno = busno;
parms->itc_slotno = slotno; parms->itc_slotno = slotno;
parms->itc_virtbus = virtbus; parms->itc_virtbus = virtbus;
......
...@@ -119,10 +119,9 @@ static int proc_viopath_show(struct seq_file *m, void *v) ...@@ -119,10 +119,9 @@ static int proc_viopath_show(struct seq_file *m, void *v)
struct device_node *node; struct device_node *node;
const char *sysid; const char *sysid;
buf = kmalloc(HW_PAGE_SIZE, GFP_KERNEL); buf = kzalloc(HW_PAGE_SIZE, GFP_KERNEL);
if (!buf) if (!buf)
return 0; return 0;
memset(buf, 0, HW_PAGE_SIZE);
handle = dma_map_single(iSeries_vio_dev, buf, HW_PAGE_SIZE, handle = dma_map_single(iSeries_vio_dev, buf, HW_PAGE_SIZE,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
......
...@@ -268,11 +268,10 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length ...@@ -268,11 +268,10 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
static struct property *new_property(const char *name, const int length, static struct property *new_property(const char *name, const int length,
const unsigned char *value, struct property *last) const unsigned char *value, struct property *last)
{ {
struct property *new = kmalloc(sizeof(*new), GFP_KERNEL); struct property *new = kzalloc(sizeof(*new), GFP_KERNEL);
if (!new) if (!new)
return NULL; return NULL;
memset(new, 0, sizeof(*new));
if (!(new->name = kmalloc(strlen(name) + 1, GFP_KERNEL))) if (!(new->name = kmalloc(strlen(name) + 1, GFP_KERNEL)))
goto cleanup; goto cleanup;
......
...@@ -216,14 +216,12 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc ...@@ -216,14 +216,12 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
return -EINVAL; return -EINVAL;
} }
uccf = (struct ucc_fast_private *) uccf = kzalloc(sizeof(struct ucc_fast_private), GFP_KERNEL);
kmalloc(sizeof(struct ucc_fast_private), GFP_KERNEL);
if (!uccf) { if (!uccf) {
uccf_err uccf_err
("ucc_fast_init: No memory for UCC slow data structure!"); ("ucc_fast_init: No memory for UCC slow data structure!");
return -ENOMEM; return -ENOMEM;
} }
memset(uccf, 0, sizeof(struct ucc_fast_private));
/* Fill fast UCC structure */ /* Fill fast UCC structure */
uccf->uf_info = uf_info; uccf->uf_info = uf_info;
......
...@@ -168,14 +168,12 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc ...@@ -168,14 +168,12 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
return -EINVAL; return -EINVAL;
} }
uccs = (struct ucc_slow_private *) uccs = kzalloc(sizeof(struct ucc_slow_private), GFP_KERNEL);
kmalloc(sizeof(struct ucc_slow_private), GFP_KERNEL);
if (!uccs) { if (!uccs) {
uccs_err uccs_err
("ucc_slow_init: No memory for UCC slow data structure!"); ("ucc_slow_init: No memory for UCC slow data structure!");
return -ENOMEM; return -ENOMEM;
} }
memset(uccs, 0, sizeof(struct ucc_slow_private));
/* Fill slow UCC structure */ /* Fill slow UCC structure */
uccs->us_info = us_info; uccs->us_info = us_info;
......
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