]> err.no Git - linux-2.6/commitdiff
[SPARC64]: kzalloc() conversion
authorEric Sesterhenn <snakebyte@gmx.de>
Mon, 6 Mar 2006 21:48:40 +0000 (13:48 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 20 Mar 2006 09:14:19 +0000 (01:14 -0800)
this patch converts arch/sparc64 to kzalloc usage.
Crosscompile tested with allyesconfig.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/ebus.c
arch/sparc64/kernel/irq.c
arch/sparc64/kernel/pci_common.c
arch/sparc64/kernel/pci_iommu.c
arch/sparc64/kernel/pci_psycho.c
arch/sparc64/kernel/pci_sabre.c
arch/sparc64/kernel/pci_schizo.c
arch/sparc64/kernel/setup.c
arch/sparc64/kernel/sys_sparc.c
arch/sparc64/kernel/us2e_cpufreq.c
arch/sparc64/kernel/us3_cpufreq.c

index 7991e919d8ab6801605f040c1b16f2df1277975f..c69504aa638f59418a3bf08040cabb57fc85767f 100644 (file)
@@ -277,10 +277,9 @@ static inline void *ebus_alloc(size_t size)
 {
        void *mem;
 
-       mem = kmalloc(size, GFP_ATOMIC);
+       mem = kzalloc(size, GFP_ATOMIC);
        if (!mem)
                panic("ebus_alloc: out of memory");
-       memset((char *)mem, 0, size);
        return mem;
 }
 
index 712b16cdd5fbb30ffe5d7a30f43e85f924489bf1..8c93ba655b33ba2325595c2ab97a2f04d2f96f45 100644 (file)
@@ -316,12 +316,11 @@ unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long
                goto out;
        }
 
-       bucket->irq_info = kmalloc(sizeof(struct irq_desc), GFP_ATOMIC);
+       bucket->irq_info = kzalloc(sizeof(struct irq_desc), GFP_ATOMIC);
        if (!bucket->irq_info) {
                prom_printf("IRQ: Error, kmalloc(irq_desc) failed.\n");
                prom_halt();
        }
-       memset(bucket->irq_info, 0, sizeof(struct irq_desc));
 
        /* Ok, looks good, set it up.  Don't touch the irq_chain or
         * the pending flag.
@@ -357,12 +356,11 @@ unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino, int pil, unsign
        bucket->pil = pil;
        bucket->flags = flags;
 
-       bucket->irq_info = kmalloc(sizeof(struct irq_desc), GFP_ATOMIC);
+       bucket->irq_info = kzalloc(sizeof(struct irq_desc), GFP_ATOMIC);
        if (!bucket->irq_info) {
                prom_printf("IRQ: Error, kmalloc(irq_desc) failed.\n");
                prom_halt();
        }
-       memset(bucket->irq_info, 0, sizeof(struct irq_desc));
 
        return __irq(bucket);
 }
index 1448294a23798272b81fd7ad7caf3aba465910b9..33dedb1aacd49e551562e4538da73843d4d6ae41 100644 (file)
@@ -977,33 +977,30 @@ void pci_register_legacy_regions(struct resource *io_res,
        struct resource *p;
 
        /* VGA Video RAM. */
-       p = kmalloc(sizeof(*p), GFP_KERNEL);
+       p = kzalloc(sizeof(*p), GFP_KERNEL);
        if (!p)
                return;
 
-       memset(p, 0, sizeof(*p));
        p->name = "Video RAM area";
        p->start = mem_res->start + 0xa0000UL;
        p->end = p->start + 0x1ffffUL;
        p->flags = IORESOURCE_BUSY;
        request_resource(mem_res, p);
 
-       p = kmalloc(sizeof(*p), GFP_KERNEL);
+       p = kzalloc(sizeof(*p), GFP_KERNEL);
        if (!p)
                return;
 
-       memset(p, 0, sizeof(*p));
        p->name = "System ROM";
        p->start = mem_res->start + 0xf0000UL;
        p->end = p->start + 0xffffUL;
        p->flags = IORESOURCE_BUSY;
        request_resource(mem_res, p);
 
-       p = kmalloc(sizeof(*p), GFP_KERNEL);
+       p = kzalloc(sizeof(*p), GFP_KERNEL);
        if (!p)
                return;
 
-       memset(p, 0, sizeof(*p));
        p->name = "Video ROM";
        p->start = mem_res->start + 0xc0000UL;
        p->end = p->start + 0x7fffUL;
index c9320eac45d39710396d5213444194dd397ade40..8efbc139769d22d45990266d941055a7fef4a0c6 100644 (file)
@@ -139,12 +139,11 @@ void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset,
        /* Allocate and initialize the free area map.  */
        sz = num_tsb_entries / 8;
        sz = (sz + 7UL) & ~7UL;
-       iommu->arena.map = kmalloc(sz, GFP_KERNEL);
+       iommu->arena.map = kzalloc(sz, GFP_KERNEL);
        if (!iommu->arena.map) {
                prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n");
                prom_halt();
        }
-       memset(iommu->arena.map, 0, sz);
        iommu->arena.limit = num_tsb_entries;
 
        /* Allocate and initialize the dummy page which we
index c03ed5f49d31500cc90bb4b1abd8d0f996e6aa5e..f7b16e49c28becce669e0f70fc2b2deeaab242b7 100644 (file)
@@ -1164,7 +1164,7 @@ static void pbm_config_busmastering(struct pci_pbm_info *pbm)
 static void pbm_scan_bus(struct pci_controller_info *p,
                         struct pci_pbm_info *pbm)
 {
-       struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
+       struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
 
        if (!cookie) {
                prom_printf("PSYCHO: Critical allocation failure.\n");
@@ -1172,7 +1172,6 @@ static void pbm_scan_bus(struct pci_controller_info *p,
        }
 
        /* All we care about is the PBM. */
-       memset(cookie, 0, sizeof(*cookie));
        cookie->pbm = pbm;
 
        pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno,
@@ -1465,18 +1464,16 @@ void psycho_init(int node, char *model_name)
                }
        }
 
-       p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
+       p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
        if (!p) {
                prom_printf("PSYCHO: Fatal memory allocation error.\n");
                prom_halt();
        }
-       memset(p, 0, sizeof(*p));
-       iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
+       iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
        if (!iommu) {
                prom_printf("PSYCHO: Fatal memory allocation error.\n");
                prom_halt();
        }
-       memset(iommu, 0, sizeof(*iommu));
        p->pbm_A.iommu = p->pbm_B.iommu = iommu;
 
        p->next = pci_controller_root;
index da8e1364194f81f214a58b34e9493b2813542599..5ddc92931976bb5b79cd06b87b8d2a9dfa80f4f8 100644 (file)
@@ -1167,7 +1167,7 @@ static void apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus)
 
 static struct pcidev_cookie *alloc_bridge_cookie(struct pci_pbm_info *pbm)
 {
-       struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
+       struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
 
        if (!cookie) {
                prom_printf("SABRE: Critical allocation failure.\n");
@@ -1175,7 +1175,6 @@ static struct pcidev_cookie *alloc_bridge_cookie(struct pci_pbm_info *pbm)
        }
 
        /* All we care about is the PBM. */
-       memset(cookie, 0, sizeof(*cookie));
        cookie->pbm = pbm;
 
        return cookie;
@@ -1556,19 +1555,17 @@ void sabre_init(int pnode, char *model_name)
                }
        }
 
-       p = kmalloc(sizeof(*p), GFP_ATOMIC);
+       p = kzalloc(sizeof(*p), GFP_ATOMIC);
        if (!p) {
                prom_printf("SABRE: Error, kmalloc(pci_controller_info) failed.\n");
                prom_halt();
        }
-       memset(p, 0, sizeof(*p));
 
-       iommu = kmalloc(sizeof(*iommu), GFP_ATOMIC);
+       iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC);
        if (!iommu) {
                prom_printf("SABRE: Error, kmalloc(pci_iommu) failed.\n");
                prom_halt();
        }
-       memset(iommu, 0, sizeof(*iommu));
        p->pbm_A.iommu = p->pbm_B.iommu = iommu;
 
        upa_portid = prom_getintdefault(pnode, "upa-portid", 0xff);
index d8c4e0919b4edde0973bcd45102efe72e0fb8328..3a89f29e27d62861bdaab5dd9c350f4ddb824150 100644 (file)
@@ -1525,7 +1525,7 @@ static void pbm_config_busmastering(struct pci_pbm_info *pbm)
 static void pbm_scan_bus(struct pci_controller_info *p,
                         struct pci_pbm_info *pbm)
 {
-       struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
+       struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
 
        if (!cookie) {
                prom_printf("%s: Critical allocation failure.\n", pbm->name);
@@ -1533,7 +1533,6 @@ static void pbm_scan_bus(struct pci_controller_info *p,
        }
 
        /* All we care about is the PBM. */
-       memset(cookie, 0, sizeof(*cookie));
        cookie->pbm = pbm;
 
        pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno,
@@ -2120,27 +2119,24 @@ static void __schizo_init(int node, char *model_name, int chip_type)
                }
        }
 
-       p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
+       p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
        if (!p) {
                prom_printf("SCHIZO: Fatal memory allocation error.\n");
                prom_halt();
        }
-       memset(p, 0, sizeof(*p));
 
-       iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
+       iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
        if (!iommu) {
                prom_printf("SCHIZO: Fatal memory allocation error.\n");
                prom_halt();
        }
-       memset(iommu, 0, sizeof(*iommu));
        p->pbm_A.iommu = iommu;
 
-       iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
+       iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
        if (!iommu) {
                prom_printf("SCHIZO: Fatal memory allocation error.\n");
                prom_halt();
        }
-       memset(iommu, 0, sizeof(*iommu));
        p->pbm_B.iommu = iommu;
 
        p->next = pci_controller_root;
index 0c68a76143af75cbe20f4947726113f187ab0831..2a2a8a6cd17d7ed01ee5230b5606bea968c9e411 100644 (file)
@@ -536,15 +536,11 @@ static int __init topology_init(void)
        while (!cpu_find_by_instance(ncpus_probed, NULL, NULL))
                ncpus_probed++;
 
-       for (i = 0; i < NR_CPUS; i++) {
-               if (cpu_possible(i)) {
-                       struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL);
-
-                       if (p) {
-                               memset(p, 0, sizeof(*p));
-                               register_cpu(p, i, NULL);
-                               err = 0;
-                       }
+       for_each_cpu(i) {
+               struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
+               if (p) {
+                       register_cpu(p, i, NULL);
+                       err = 0;
                }
        }
 
index 095db723bb8a1d17a1ae6fcc1f2621c60b6a8536..8840415408be18865ea24358b08bc850d211c7a4 100644 (file)
@@ -600,12 +600,10 @@ asmlinkage long sys_utrap_install(utrap_entry_t type,
        }
        if (!current_thread_info()->utraps) {
                current_thread_info()->utraps =
-                       kmalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
+                       kzalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
                if (!current_thread_info()->utraps)
                        return -ENOMEM;
                current_thread_info()->utraps[0] = 1;
-               memset(current_thread_info()->utraps+1, 0,
-                      UT_TRAP_INSTRUCTION_31*sizeof(long));
        } else {
                if ((utrap_handler_t)current_thread_info()->utraps[type] != new_p &&
                    current_thread_info()->utraps[0] > 1) {
index 669fb83dd4f5d2c4a4e4279c7c2bdbd22e6d6859..1f83fe6a82d628bfbacf63795799b401d4812903 100644 (file)
@@ -357,20 +357,16 @@ static int __init us2e_freq_init(void)
                struct cpufreq_driver *driver;
 
                ret = -ENOMEM;
-               driver = kmalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
+               driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
                if (!driver)
                        goto err_out;
-               memset(driver, 0, sizeof(*driver));
 
-               us2e_freq_table = kmalloc(
+               us2e_freq_table = kzalloc(
                        (NR_CPUS * sizeof(struct us2e_freq_percpu_info)),
                        GFP_KERNEL);
                if (!us2e_freq_table)
                        goto err_out;
 
-               memset(us2e_freq_table, 0,
-                      (NR_CPUS * sizeof(struct us2e_freq_percpu_info)));
-
                driver->init = us2e_freq_cpu_init;
                driver->verify = us2e_freq_verify;
                driver->target = us2e_freq_target;
index a912c45bdc0547f89392de5f5a3df69f65a14730..47e3acafb5be4c0f0786bbe12fd2b353334f4d92 100644 (file)
@@ -218,20 +218,16 @@ static int __init us3_freq_init(void)
                struct cpufreq_driver *driver;
 
                ret = -ENOMEM;
-               driver = kmalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
+               driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
                if (!driver)
                        goto err_out;
-               memset(driver, 0, sizeof(*driver));
 
-               us3_freq_table = kmalloc(
+               us3_freq_table = kzalloc(
                        (NR_CPUS * sizeof(struct us3_freq_percpu_info)),
                        GFP_KERNEL);
                if (!us3_freq_table)
                        goto err_out;
 
-               memset(us3_freq_table, 0,
-                      (NR_CPUS * sizeof(struct us3_freq_percpu_info)));
-
                driver->init = us3_freq_cpu_init;
                driver->verify = us3_freq_verify;
                driver->target = us3_freq_target;