Commit 9132983ae140a8ca81e95e081d5a4c0dd7a7f670

Authored by Eric Sesterhenn
Committed by David S. Miller
1 parent f7c00338cf

[SPARC64]: kzalloc() conversion

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>

Showing 11 changed files with 27 additions and 58 deletions Side-by-side Diff

arch/sparc64/kernel/ebus.c
... ... @@ -277,10 +277,9 @@
277 277 {
278 278 void *mem;
279 279  
280   - mem = kmalloc(size, GFP_ATOMIC);
  280 + mem = kzalloc(size, GFP_ATOMIC);
281 281 if (!mem)
282 282 panic("ebus_alloc: out of memory");
283   - memset((char *)mem, 0, size);
284 283 return mem;
285 284 }
286 285  
arch/sparc64/kernel/irq.c
... ... @@ -316,12 +316,11 @@
316 316 goto out;
317 317 }
318 318  
319   - bucket->irq_info = kmalloc(sizeof(struct irq_desc), GFP_ATOMIC);
  319 + bucket->irq_info = kzalloc(sizeof(struct irq_desc), GFP_ATOMIC);
320 320 if (!bucket->irq_info) {
321 321 prom_printf("IRQ: Error, kmalloc(irq_desc) failed.\n");
322 322 prom_halt();
323 323 }
324   - memset(bucket->irq_info, 0, sizeof(struct irq_desc));
325 324  
326 325 /* Ok, looks good, set it up. Don't touch the irq_chain or
327 326 * the pending flag.
328 327  
... ... @@ -357,12 +356,11 @@
357 356 bucket->pil = pil;
358 357 bucket->flags = flags;
359 358  
360   - bucket->irq_info = kmalloc(sizeof(struct irq_desc), GFP_ATOMIC);
  359 + bucket->irq_info = kzalloc(sizeof(struct irq_desc), GFP_ATOMIC);
361 360 if (!bucket->irq_info) {
362 361 prom_printf("IRQ: Error, kmalloc(irq_desc) failed.\n");
363 362 prom_halt();
364 363 }
365   - memset(bucket->irq_info, 0, sizeof(struct irq_desc));
366 364  
367 365 return __irq(bucket);
368 366 }
arch/sparc64/kernel/pci_common.c
... ... @@ -977,33 +977,30 @@
977 977 struct resource *p;
978 978  
979 979 /* VGA Video RAM. */
980   - p = kmalloc(sizeof(*p), GFP_KERNEL);
  980 + p = kzalloc(sizeof(*p), GFP_KERNEL);
981 981 if (!p)
982 982 return;
983 983  
984   - memset(p, 0, sizeof(*p));
985 984 p->name = "Video RAM area";
986 985 p->start = mem_res->start + 0xa0000UL;
987 986 p->end = p->start + 0x1ffffUL;
988 987 p->flags = IORESOURCE_BUSY;
989 988 request_resource(mem_res, p);
990 989  
991   - p = kmalloc(sizeof(*p), GFP_KERNEL);
  990 + p = kzalloc(sizeof(*p), GFP_KERNEL);
992 991 if (!p)
993 992 return;
994 993  
995   - memset(p, 0, sizeof(*p));
996 994 p->name = "System ROM";
997 995 p->start = mem_res->start + 0xf0000UL;
998 996 p->end = p->start + 0xffffUL;
999 997 p->flags = IORESOURCE_BUSY;
1000 998 request_resource(mem_res, p);
1001 999  
1002   - p = kmalloc(sizeof(*p), GFP_KERNEL);
  1000 + p = kzalloc(sizeof(*p), GFP_KERNEL);
1003 1001 if (!p)
1004 1002 return;
1005 1003  
1006   - memset(p, 0, sizeof(*p));
1007 1004 p->name = "Video ROM";
1008 1005 p->start = mem_res->start + 0xc0000UL;
1009 1006 p->end = p->start + 0x7fffUL;
arch/sparc64/kernel/pci_iommu.c
... ... @@ -139,12 +139,11 @@
139 139 /* Allocate and initialize the free area map. */
140 140 sz = num_tsb_entries / 8;
141 141 sz = (sz + 7UL) & ~7UL;
142   - iommu->arena.map = kmalloc(sz, GFP_KERNEL);
  142 + iommu->arena.map = kzalloc(sz, GFP_KERNEL);
143 143 if (!iommu->arena.map) {
144 144 prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n");
145 145 prom_halt();
146 146 }
147   - memset(iommu->arena.map, 0, sz);
148 147 iommu->arena.limit = num_tsb_entries;
149 148  
150 149 /* Allocate and initialize the dummy page which we
arch/sparc64/kernel/pci_psycho.c
... ... @@ -1164,7 +1164,7 @@
1164 1164 static void pbm_scan_bus(struct pci_controller_info *p,
1165 1165 struct pci_pbm_info *pbm)
1166 1166 {
1167   - struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
  1167 + struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
1168 1168  
1169 1169 if (!cookie) {
1170 1170 prom_printf("PSYCHO: Critical allocation failure.\n");
... ... @@ -1172,7 +1172,6 @@
1172 1172 }
1173 1173  
1174 1174 /* All we care about is the PBM. */
1175   - memset(cookie, 0, sizeof(*cookie));
1176 1175 cookie->pbm = pbm;
1177 1176  
1178 1177 pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno,
1179 1178  
1180 1179  
... ... @@ -1465,18 +1464,16 @@
1465 1464 }
1466 1465 }
1467 1466  
1468   - p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
  1467 + p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
1469 1468 if (!p) {
1470 1469 prom_printf("PSYCHO: Fatal memory allocation error.\n");
1471 1470 prom_halt();
1472 1471 }
1473   - memset(p, 0, sizeof(*p));
1474   - iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
  1472 + iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
1475 1473 if (!iommu) {
1476 1474 prom_printf("PSYCHO: Fatal memory allocation error.\n");
1477 1475 prom_halt();
1478 1476 }
1479   - memset(iommu, 0, sizeof(*iommu));
1480 1477 p->pbm_A.iommu = p->pbm_B.iommu = iommu;
1481 1478  
1482 1479 p->next = pci_controller_root;
arch/sparc64/kernel/pci_sabre.c
... ... @@ -1167,7 +1167,7 @@
1167 1167  
1168 1168 static struct pcidev_cookie *alloc_bridge_cookie(struct pci_pbm_info *pbm)
1169 1169 {
1170   - struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
  1170 + struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
1171 1171  
1172 1172 if (!cookie) {
1173 1173 prom_printf("SABRE: Critical allocation failure.\n");
... ... @@ -1175,7 +1175,6 @@
1175 1175 }
1176 1176  
1177 1177 /* All we care about is the PBM. */
1178   - memset(cookie, 0, sizeof(*cookie));
1179 1178 cookie->pbm = pbm;
1180 1179  
1181 1180 return cookie;
1182 1181  
1183 1182  
1184 1183  
... ... @@ -1556,19 +1555,17 @@
1556 1555 }
1557 1556 }
1558 1557  
1559   - p = kmalloc(sizeof(*p), GFP_ATOMIC);
  1558 + p = kzalloc(sizeof(*p), GFP_ATOMIC);
1560 1559 if (!p) {
1561 1560 prom_printf("SABRE: Error, kmalloc(pci_controller_info) failed.\n");
1562 1561 prom_halt();
1563 1562 }
1564   - memset(p, 0, sizeof(*p));
1565 1563  
1566   - iommu = kmalloc(sizeof(*iommu), GFP_ATOMIC);
  1564 + iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC);
1567 1565 if (!iommu) {
1568 1566 prom_printf("SABRE: Error, kmalloc(pci_iommu) failed.\n");
1569 1567 prom_halt();
1570 1568 }
1571   - memset(iommu, 0, sizeof(*iommu));
1572 1569 p->pbm_A.iommu = p->pbm_B.iommu = iommu;
1573 1570  
1574 1571 upa_portid = prom_getintdefault(pnode, "upa-portid", 0xff);
arch/sparc64/kernel/pci_schizo.c
... ... @@ -1525,7 +1525,7 @@
1525 1525 static void pbm_scan_bus(struct pci_controller_info *p,
1526 1526 struct pci_pbm_info *pbm)
1527 1527 {
1528   - struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
  1528 + struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
1529 1529  
1530 1530 if (!cookie) {
1531 1531 prom_printf("%s: Critical allocation failure.\n", pbm->name);
... ... @@ -1533,7 +1533,6 @@
1533 1533 }
1534 1534  
1535 1535 /* All we care about is the PBM. */
1536   - memset(cookie, 0, sizeof(*cookie));
1537 1536 cookie->pbm = pbm;
1538 1537  
1539 1538 pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno,
1540 1539  
1541 1540  
1542 1541  
1543 1542  
1544 1543  
... ... @@ -2120,27 +2119,24 @@
2120 2119 }
2121 2120 }
2122 2121  
2123   - p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
  2122 + p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
2124 2123 if (!p) {
2125 2124 prom_printf("SCHIZO: Fatal memory allocation error.\n");
2126 2125 prom_halt();
2127 2126 }
2128   - memset(p, 0, sizeof(*p));
2129 2127  
2130   - iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
  2128 + iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
2131 2129 if (!iommu) {
2132 2130 prom_printf("SCHIZO: Fatal memory allocation error.\n");
2133 2131 prom_halt();
2134 2132 }
2135   - memset(iommu, 0, sizeof(*iommu));
2136 2133 p->pbm_A.iommu = iommu;
2137 2134  
2138   - iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
  2135 + iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
2139 2136 if (!iommu) {
2140 2137 prom_printf("SCHIZO: Fatal memory allocation error.\n");
2141 2138 prom_halt();
2142 2139 }
2143   - memset(iommu, 0, sizeof(*iommu));
2144 2140 p->pbm_B.iommu = iommu;
2145 2141  
2146 2142 p->next = pci_controller_root;
arch/sparc64/kernel/setup.c
... ... @@ -536,15 +536,11 @@
536 536 while (!cpu_find_by_instance(ncpus_probed, NULL, NULL))
537 537 ncpus_probed++;
538 538  
539   - for (i = 0; i < NR_CPUS; i++) {
540   - if (cpu_possible(i)) {
541   - struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL);
542   -
543   - if (p) {
544   - memset(p, 0, sizeof(*p));
545   - register_cpu(p, i, NULL);
546   - err = 0;
547   - }
  539 + for_each_cpu(i) {
  540 + struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
  541 + if (p) {
  542 + register_cpu(p, i, NULL);
  543 + err = 0;
548 544 }
549 545 }
550 546  
arch/sparc64/kernel/sys_sparc.c
... ... @@ -600,12 +600,10 @@
600 600 }
601 601 if (!current_thread_info()->utraps) {
602 602 current_thread_info()->utraps =
603   - kmalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
  603 + kzalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
604 604 if (!current_thread_info()->utraps)
605 605 return -ENOMEM;
606 606 current_thread_info()->utraps[0] = 1;
607   - memset(current_thread_info()->utraps+1, 0,
608   - UT_TRAP_INSTRUCTION_31*sizeof(long));
609 607 } else {
610 608 if ((utrap_handler_t)current_thread_info()->utraps[type] != new_p &&
611 609 current_thread_info()->utraps[0] > 1) {
arch/sparc64/kernel/us2e_cpufreq.c
... ... @@ -357,19 +357,15 @@
357 357 struct cpufreq_driver *driver;
358 358  
359 359 ret = -ENOMEM;
360   - driver = kmalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
  360 + driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
361 361 if (!driver)
362 362 goto err_out;
363   - memset(driver, 0, sizeof(*driver));
364 363  
365   - us2e_freq_table = kmalloc(
  364 + us2e_freq_table = kzalloc(
366 365 (NR_CPUS * sizeof(struct us2e_freq_percpu_info)),
367 366 GFP_KERNEL);
368 367 if (!us2e_freq_table)
369 368 goto err_out;
370   -
371   - memset(us2e_freq_table, 0,
372   - (NR_CPUS * sizeof(struct us2e_freq_percpu_info)));
373 369  
374 370 driver->init = us2e_freq_cpu_init;
375 371 driver->verify = us2e_freq_verify;
arch/sparc64/kernel/us3_cpufreq.c
... ... @@ -218,19 +218,15 @@
218 218 struct cpufreq_driver *driver;
219 219  
220 220 ret = -ENOMEM;
221   - driver = kmalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
  221 + driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
222 222 if (!driver)
223 223 goto err_out;
224   - memset(driver, 0, sizeof(*driver));
225 224  
226   - us3_freq_table = kmalloc(
  225 + us3_freq_table = kzalloc(
227 226 (NR_CPUS * sizeof(struct us3_freq_percpu_info)),
228 227 GFP_KERNEL);
229 228 if (!us3_freq_table)
230 229 goto err_out;
231   -
232   - memset(us3_freq_table, 0,
233   - (NR_CPUS * sizeof(struct us3_freq_percpu_info)));
234 230  
235 231 driver->init = us3_freq_cpu_init;
236 232 driver->verify = us3_freq_verify;