]> err.no Git - linux-2.6/commitdiff
[POWERPC] Replace kmalloc+memset with kzalloc
authorYan Burman <burman.yan@gmail.com>
Sat, 2 Dec 2006 11:26:57 +0000 (13:26 +0200)
committerPaul Mackerras <paulus@samba.org>
Mon, 4 Dec 2006 09:42:09 +0000 (20:42 +1100)
Replace kmalloc+memset with kzalloc.

Signed-off-by: Yan Burman <burman.yan@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/ibmebus.c
arch/powerpc/kernel/pci_64.c
arch/powerpc/kernel/rtas_flash.c
arch/powerpc/kernel/smp-tbsync.c
arch/powerpc/platforms/iseries/iommu.c
arch/powerpc/platforms/iseries/viopath.c
arch/powerpc/platforms/pseries/reconfig.c
arch/powerpc/sysdev/qe_lib/ucc_fast.c
arch/powerpc/sysdev/qe_lib/ucc_slow.c

index 8e515797de6ae1552a091d089807011b41f25f7a..82bd2f10770f9a8d732f0bc287182f94fcf00eec 100644 (file)
@@ -214,11 +214,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
                return NULL;
        }
 
-       dev = kmalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
+       dev = kzalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
        if (!dev) {
                return NULL;
        }
-       memset(dev, 0, sizeof(struct ibmebus_dev));
 
        dev->ofdev.node = of_node_get(dn);
        
index afee470de92440120eb8c51b377c065ae28b18d5..6fa9a0a5c8dbb7f0a700c0e88048e7037caaa63f 100644 (file)
@@ -330,7 +330,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
        struct pci_dev *dev;
        const char *type;
 
-       dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
+       dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
        if (!dev)
                return NULL;
        type = get_property(node, "device_type", NULL);
@@ -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);
 
-       memset(dev, 0, sizeof(struct pci_dev));
        dev->bus = bus;
        dev->sysdata = node;
        dev->dev.parent = bus->bridge;
index 6f6fc977cb399a189c0d530dc44badf1c4a021ce..b9561d300516d7d6f98b2de749102207ce43f050 100644 (file)
@@ -681,14 +681,12 @@ static int initialize_flash_pde_data(const char *rtas_call_name,
        int *status;
        int token;
 
-       dp->data = kmalloc(buf_size, GFP_KERNEL);
+       dp->data = kzalloc(buf_size, GFP_KERNEL);
        if (dp->data == NULL) {
                remove_flash_pde(dp);
                return -ENOMEM;
        }
 
-       memset(dp->data, 0, buf_size);
-
        /*
         * This code assumes that the status int is the first member of the
         * struct 
index e1970f83f14abee0bb6d18e9f4f7856d5f76ae55..bc892e69b4f732cd11c46a5ccb79be51eaf34fae 100644 (file)
@@ -116,8 +116,7 @@ void __devinit smp_generic_give_timebase(void)
        printk("Synchronizing timebase\n");
 
        /* if this fails then this kernel won't work anyway... */
-       tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL );
-       memset( tbsync, 0, sizeof(*tbsync) );
+       tbsync = kzalloc( sizeof(*tbsync), GFP_KERNEL );
        mb();
        running = 1;
 
index ee0a4e42e4f06deca57b4b8d15cc73dabe604f95..d7a756d5135cf4ee0ba6366106f69a2b639658db 100644 (file)
@@ -115,12 +115,10 @@ void iommu_table_getparms_iSeries(unsigned long busno,
 {
        struct iommu_table_cb *parms;
 
-       parms = kmalloc(sizeof(*parms), GFP_KERNEL);
+       parms = kzalloc(sizeof(*parms), GFP_KERNEL);
        if (parms == NULL)
                panic("PCI_DMA: TCE Table Allocation failed.");
 
-       memset(parms, 0, sizeof(*parms));
-
        parms->itc_busno = busno;
        parms->itc_slotno = slotno;
        parms->itc_virtbus = virtbus;
index 04e07e5da0c10010d7e2c458fc4adb9f921b6779..84e7ee2c086f59f21bec9a99b0ce368b07b11676 100644 (file)
@@ -119,10 +119,9 @@ static int proc_viopath_show(struct seq_file *m, void *v)
        struct device_node *node;
        const char *sysid;
 
-       buf = kmalloc(HW_PAGE_SIZE, GFP_KERNEL);
+       buf = kzalloc(HW_PAGE_SIZE, GFP_KERNEL);
        if (!buf)
                return 0;
-       memset(buf, 0, HW_PAGE_SIZE);
 
        handle = dma_map_single(iSeries_vio_dev, buf, HW_PAGE_SIZE,
                                DMA_FROM_DEVICE);
index 1773103354be458c22c32e0f79f8a10bdac08868..4ad33e41b0082794582e9a8710d063aa6e7ab599 100644 (file)
@@ -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,
                                     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)
                return NULL;
-       memset(new, 0, sizeof(*new));
 
        if (!(new->name = kmalloc(strlen(name) + 1, GFP_KERNEL)))
                goto cleanup;
index 75fa3104a43aaeb4ac1bdde7cdd1a19045c2b22e..e657559bea93fdec3f80fad8e6dbdefec4ce1c5a 100644 (file)
@@ -216,14 +216,12 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
                return -EINVAL;
        }
 
-       uccf = (struct ucc_fast_private *)
-                kmalloc(sizeof(struct ucc_fast_private), GFP_KERNEL);
+       uccf = kzalloc(sizeof(struct ucc_fast_private), GFP_KERNEL);
        if (!uccf) {
                uccf_err
                    ("ucc_fast_init: No memory for UCC slow data structure!");
                return -ENOMEM;
        }
-       memset(uccf, 0, sizeof(struct ucc_fast_private));
 
        /* Fill fast UCC structure */
        uccf->uf_info = uf_info;
index a49da6b73ecf6c2d8fa0d23b71f872ca362c07b0..47b56203f47ee0017656ba1d654f831b8dd2e74d 100644 (file)
@@ -168,14 +168,12 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
                return -EINVAL;
        }
 
-       uccs = (struct ucc_slow_private *)
-               kmalloc(sizeof(struct ucc_slow_private), GFP_KERNEL);
+       uccs = kzalloc(sizeof(struct ucc_slow_private), GFP_KERNEL);
        if (!uccs) {
                uccs_err
                    ("ucc_slow_init: No memory for UCC slow data structure!");
                return -ENOMEM;
        }
-       memset(uccs, 0, sizeof(struct ucc_slow_private));
 
        /* Fill slow UCC structure */
        uccs->us_info = us_info;