aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-03-20 14:46:41 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-03-21 17:06:17 -0500
commitd2a02b93cf78205dd23226efb66481569900976e (patch)
tree94760abdafe5cb72a41d3edd405a26d0c8e2e0d3 /arch/arm
parent18ec5c731271939acb414614e964c15c8ef52156 (diff)
[ARM] Convert kmalloc+memset to kzalloc
Convert all uses of kmalloc followed by memset to use kzalloc instead. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/common/locomo.c7
-rw-r--r--arch/arm/common/sa1111.c7
-rw-r--r--arch/arm/common/scoop.c6
-rw-r--r--arch/arm/kernel/apm.c4
-rw-r--r--arch/arm/kernel/bios32.c4
-rw-r--r--arch/arm/kernel/ecard.c4
-rw-r--r--arch/arm/mach-footbridge/dc21285.c4
-rw-r--r--arch/arm/mach-integrator/impd1.c7
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c4
-rw-r--r--arch/arm/mach-iop3xx/iq31244-pci.c4
-rw-r--r--arch/arm/mach-iop3xx/iq80321-pci.c4
-rw-r--r--arch/arm/mach-iop3xx/iq80331-pci.c4
-rw-r--r--arch/arm/mach-iop3xx/iq80332-pci.c4
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c3
14 files changed, 18 insertions, 48 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 787e0d027f04..a7dc1370695b 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -501,12 +501,11 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
501 struct locomo_dev *dev; 501 struct locomo_dev *dev;
502 int ret; 502 int ret;
503 503
504 dev = kmalloc(sizeof(struct locomo_dev), GFP_KERNEL); 504 dev = kzalloc(sizeof(struct locomo_dev), GFP_KERNEL);
505 if (!dev) { 505 if (!dev) {
506 ret = -ENOMEM; 506 ret = -ENOMEM;
507 goto out; 507 goto out;
508 } 508 }
509 memset(dev, 0, sizeof(struct locomo_dev));
510 509
511 strncpy(dev->dev.bus_id,info->name,sizeof(dev->dev.bus_id)); 510 strncpy(dev->dev.bus_id,info->name,sizeof(dev->dev.bus_id));
512 /* 511 /*
@@ -664,12 +663,10 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
664 unsigned long r; 663 unsigned long r;
665 int i, ret = -ENODEV; 664 int i, ret = -ENODEV;
666 665
667 lchip = kmalloc(sizeof(struct locomo), GFP_KERNEL); 666 lchip = kzalloc(sizeof(struct locomo), GFP_KERNEL);
668 if (!lchip) 667 if (!lchip)
669 return -ENOMEM; 668 return -ENOMEM;
670 669
671 memset(lchip, 0, sizeof(struct locomo));
672
673 spin_lock_init(&lchip->lock); 670 spin_lock_init(&lchip->lock);
674 671
675 lchip->dev = me; 672 lchip->dev = me;
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 5ba1ee042349..3f68db84e5e6 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -541,12 +541,11 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
541 struct sa1111_dev *dev; 541 struct sa1111_dev *dev;
542 int ret; 542 int ret;
543 543
544 dev = kmalloc(sizeof(struct sa1111_dev), GFP_KERNEL); 544 dev = kzalloc(sizeof(struct sa1111_dev), GFP_KERNEL);
545 if (!dev) { 545 if (!dev) {
546 ret = -ENOMEM; 546 ret = -ENOMEM;
547 goto out; 547 goto out;
548 } 548 }
549 memset(dev, 0, sizeof(struct sa1111_dev));
550 549
551 snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), 550 snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id),
552 "%4.4lx", info->offset); 551 "%4.4lx", info->offset);
@@ -621,12 +620,10 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
621 unsigned int has_devs, val; 620 unsigned int has_devs, val;
622 int i, ret = -ENODEV; 621 int i, ret = -ENODEV;
623 622
624 sachip = kmalloc(sizeof(struct sa1111), GFP_KERNEL); 623 sachip = kzalloc(sizeof(struct sa1111), GFP_KERNEL);
625 if (!sachip) 624 if (!sachip)
626 return -ENOMEM; 625 return -ENOMEM;
627 626
628 memset(sachip, 0, sizeof(struct sa1111));
629
630 sachip->clk = clk_get(me, "GPIO27_CLK"); 627 sachip->clk = clk_get(me, "GPIO27_CLK");
631 if (!sachip->clk) { 628 if (!sachip->clk) {
632 ret = PTR_ERR(sachip->clk); 629 ret = PTR_ERR(sachip->clk);
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index a2dfe0b0f1ec..5e830f444c6c 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -132,12 +132,10 @@ int __init scoop_probe(struct platform_device *pdev)
132 if (!mem) 132 if (!mem)
133 return -EINVAL; 133 return -EINVAL;
134 134
135 devptr = kmalloc(sizeof(struct scoop_dev), GFP_KERNEL); 135 devptr = kzalloc(sizeof(struct scoop_dev), GFP_KERNEL);
136
137 if (!devptr) 136 if (!devptr)
138 return -ENOMEM; 137 return -ENOMEM;
139 138
140 memset(devptr, 0, sizeof(struct scoop_dev));
141 spin_lock_init(&devptr->scoop_lock); 139 spin_lock_init(&devptr->scoop_lock);
142 140
143 inf = pdev->dev.platform_data; 141 inf = pdev->dev.platform_data;
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c
index 766b6c05c6db..2bed290fec76 100644
--- a/arch/arm/kernel/apm.c
+++ b/arch/arm/kernel/apm.c
@@ -357,10 +357,8 @@ static int apm_open(struct inode * inode, struct file * filp)
357{ 357{
358 struct apm_user *as; 358 struct apm_user *as;
359 359
360 as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL); 360 as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL);
361 if (as) { 361 if (as) {
362 memset(as, 0, sizeof(*as));
363
364 /* 362 /*
365 * XXX - this is a tiny bit broken, when we consider BSD 363 * XXX - this is a tiny bit broken, when we consider BSD
366 * process accounting. If the device is opened by root, we 364 * process accounting. If the device is opened by root, we
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index c4923fac8dff..de606dfa8db9 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -540,12 +540,10 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
540 int nr, busnr; 540 int nr, busnr;
541 541
542 for (nr = busnr = 0; nr < hw->nr_controllers; nr++) { 542 for (nr = busnr = 0; nr < hw->nr_controllers; nr++) {
543 sys = kmalloc(sizeof(struct pci_sys_data), GFP_KERNEL); 543 sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
544 if (!sys) 544 if (!sys)
545 panic("PCI: unable to allocate sys data!"); 545 panic("PCI: unable to allocate sys data!");
546 546
547 memset(sys, 0, sizeof(struct pci_sys_data));
548
549 sys->hw = hw; 547 sys->hw = hw;
550 sys->busnr = busnr; 548 sys->busnr = busnr;
551 sys->swizzle = hw->swizzle; 549 sys->swizzle = hw->swizzle;
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index 74ea29c3205e..00aa225e8d95 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -807,14 +807,12 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot)
807 unsigned long base; 807 unsigned long base;
808 int i; 808 int i;
809 809
810 ec = kmalloc(sizeof(ecard_t), GFP_KERNEL); 810 ec = kzalloc(sizeof(ecard_t), GFP_KERNEL);
811 if (!ec) { 811 if (!ec) {
812 ec = ERR_PTR(-ENOMEM); 812 ec = ERR_PTR(-ENOMEM);
813 goto nomem; 813 goto nomem;
814 } 814 }
815 815
816 memset(ec, 0, sizeof(ecard_t));
817
818 ec->slot_no = slot; 816 ec->slot_no = slot;
819 ec->type = type; 817 ec->type = type;
820 ec->irq = NO_IRQ; 818 ec->irq = NO_IRQ;
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index e79884eea1f7..5dace2597838 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -255,14 +255,12 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys)
255 if (nr || !footbridge_cfn_mode()) 255 if (nr || !footbridge_cfn_mode())
256 return 0; 256 return 0;
257 257
258 res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL); 258 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
259 if (!res) { 259 if (!res) {
260 printk("out of memory for root bus resources"); 260 printk("out of memory for root bus resources");
261 return 0; 261 return 0;
262 } 262 }
263 263
264 memset(res, 0, sizeof(struct resource) * 2);
265
266 res[0].flags = IORESOURCE_MEM; 264 res[0].flags = IORESOURCE_MEM;
267 res[0].name = "Footbridge non-prefetch"; 265 res[0].name = "Footbridge non-prefetch";
268 res[1].flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; 266 res[1].flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index a85d471c5bfa..92d79fb39311 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -355,12 +355,11 @@ static int impd1_probe(struct lm_device *dev)
355 if (!request_mem_region(dev->resource.start, SZ_4K, "LM registers")) 355 if (!request_mem_region(dev->resource.start, SZ_4K, "LM registers"))
356 return -EBUSY; 356 return -EBUSY;
357 357
358 impd1 = kmalloc(sizeof(struct impd1_module), GFP_KERNEL); 358 impd1 = kzalloc(sizeof(struct impd1_module), GFP_KERNEL);
359 if (!impd1) { 359 if (!impd1) {
360 ret = -ENOMEM; 360 ret = -ENOMEM;
361 goto release_lm; 361 goto release_lm;
362 } 362 }
363 memset(impd1, 0, sizeof(struct impd1_module));
364 363
365 impd1->base = ioremap(dev->resource.start, SZ_4K); 364 impd1->base = ioremap(dev->resource.start, SZ_4K);
366 if (!impd1->base) { 365 if (!impd1->base) {
@@ -389,12 +388,10 @@ static int impd1_probe(struct lm_device *dev)
389 388
390 pc_base = dev->resource.start + idev->offset; 389 pc_base = dev->resource.start + idev->offset;
391 390
392 d = kmalloc(sizeof(struct amba_device), GFP_KERNEL); 391 d = kzalloc(sizeof(struct amba_device), GFP_KERNEL);
393 if (!d) 392 if (!d)
394 continue; 393 continue;
395 394
396 memset(d, 0, sizeof(struct amba_device));
397
398 snprintf(d->dev.bus_id, sizeof(d->dev.bus_id), 395 snprintf(d->dev.bus_id, sizeof(d->dev.bus_id),
399 "lm%x:%5.5lx", dev->id, idev->offset >> 12); 396 "lm%x:%5.5lx", dev->id, idev->offset >> 12);
400 397
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index d8d3c2a5a97e..6d65c96ebfd2 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -319,12 +319,10 @@ static void __init ap_init(void)
319 if ((sc_dec & (16 << i)) == 0) 319 if ((sc_dec & (16 << i)) == 0)
320 continue; 320 continue;
321 321
322 lmdev = kmalloc(sizeof(struct lm_device), GFP_KERNEL); 322 lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
323 if (!lmdev) 323 if (!lmdev)
324 continue; 324 continue;
325 325
326 memset(lmdev, 0, sizeof(struct lm_device));
327
328 lmdev->resource.start = 0xc0000000 + 0x10000000 * i; 326 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
329 lmdev->resource.end = lmdev->resource.start + 0x0fffffff; 327 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
330 lmdev->resource.flags = IORESOURCE_MEM; 328 lmdev->resource.flags = IORESOURCE_MEM;
diff --git a/arch/arm/mach-iop3xx/iq31244-pci.c b/arch/arm/mach-iop3xx/iq31244-pci.c
index c6a973ba8fc6..f3c6413fa5bd 100644
--- a/arch/arm/mach-iop3xx/iq31244-pci.c
+++ b/arch/arm/mach-iop3xx/iq31244-pci.c
@@ -74,12 +74,10 @@ static int iq31244_setup(int nr, struct pci_sys_data *sys)
74 if(nr != 0) 74 if(nr != 0)
75 return 0; 75 return 0;
76 76
77 res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL); 77 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
78 if (!res) 78 if (!res)
79 panic("PCI: unable to alloc resources"); 79 panic("PCI: unable to alloc resources");
80 80
81 memset(res, 0, sizeof(struct resource) * 2);
82
83 res[0].start = IOP321_PCI_LOWER_IO_VA; 81 res[0].start = IOP321_PCI_LOWER_IO_VA;
84 res[0].end = IOP321_PCI_UPPER_IO_VA; 82 res[0].end = IOP321_PCI_UPPER_IO_VA;
85 res[0].name = "IQ31244 PCI I/O Space"; 83 res[0].name = "IQ31244 PCI I/O Space";
diff --git a/arch/arm/mach-iop3xx/iq80321-pci.c b/arch/arm/mach-iop3xx/iq80321-pci.c
index 802f6d091b75..d9758d3f6e7f 100644
--- a/arch/arm/mach-iop3xx/iq80321-pci.c
+++ b/arch/arm/mach-iop3xx/iq80321-pci.c
@@ -68,12 +68,10 @@ static int iq80321_setup(int nr, struct pci_sys_data *sys)
68 if(nr != 0) 68 if(nr != 0)
69 return 0; 69 return 0;
70 70
71 res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL); 71 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
72 if (!res) 72 if (!res)
73 panic("PCI: unable to alloc resources"); 73 panic("PCI: unable to alloc resources");
74 74
75 memset(res, 0, sizeof(struct resource) * 2);
76
77 res[0].start = IOP321_PCI_LOWER_IO_VA; 75 res[0].start = IOP321_PCI_LOWER_IO_VA;
78 res[0].end = IOP321_PCI_UPPER_IO_VA; 76 res[0].end = IOP321_PCI_UPPER_IO_VA;
79 res[0].name = "IQ80321 PCI I/O Space"; 77 res[0].name = "IQ80321 PCI I/O Space";
diff --git a/arch/arm/mach-iop3xx/iq80331-pci.c b/arch/arm/mach-iop3xx/iq80331-pci.c
index 654e450a1311..40d861002492 100644
--- a/arch/arm/mach-iop3xx/iq80331-pci.c
+++ b/arch/arm/mach-iop3xx/iq80331-pci.c
@@ -64,12 +64,10 @@ static int iq80331_setup(int nr, struct pci_sys_data *sys)
64 if(nr != 0) 64 if(nr != 0)
65 return 0; 65 return 0;
66 66
67 res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL); 67 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
68 if (!res) 68 if (!res)
69 panic("PCI: unable to alloc resources"); 69 panic("PCI: unable to alloc resources");
70 70
71 memset(res, 0, sizeof(struct resource) * 2);
72
73 res[0].start = IOP331_PCI_LOWER_IO_VA; 71 res[0].start = IOP331_PCI_LOWER_IO_VA;
74 res[0].end = IOP331_PCI_UPPER_IO_VA; 72 res[0].end = IOP331_PCI_UPPER_IO_VA;
75 res[0].name = "IQ80331 PCI I/O Space"; 73 res[0].name = "IQ80331 PCI I/O Space";
diff --git a/arch/arm/mach-iop3xx/iq80332-pci.c b/arch/arm/mach-iop3xx/iq80332-pci.c
index 65951ffe4631..afc0676318e4 100644
--- a/arch/arm/mach-iop3xx/iq80332-pci.c
+++ b/arch/arm/mach-iop3xx/iq80332-pci.c
@@ -70,12 +70,10 @@ static int iq80332_setup(int nr, struct pci_sys_data *sys)
70 if(nr != 0) 70 if(nr != 0)
71 return 0; 71 return 0;
72 72
73 res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL); 73 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
74 if (!res) 74 if (!res)
75 panic("PCI: unable to alloc resources"); 75 panic("PCI: unable to alloc resources");
76 76
77 memset(res, 0, sizeof(struct resource) * 2);
78
79 res[0].start = IOP331_PCI_LOWER_IO_VA; 77 res[0].start = IOP331_PCI_LOWER_IO_VA;
80 res[0].end = IOP331_PCI_UPPER_IO_VA; 78 res[0].end = IOP331_PCI_UPPER_IO_VA;
81 res[0].name = "IQ80332 PCI I/O Space"; 79 res[0].name = "IQ80332 PCI I/O Space";
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 6e3462ed5306..2d40fe1145f0 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -463,7 +463,7 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
463 if (nr >= 1) 463 if (nr >= 1)
464 return 0; 464 return 0;
465 465
466 res = kmalloc(sizeof(*res) * 2, GFP_KERNEL); 466 res = kzalloc(sizeof(*res) * 2, GFP_KERNEL);
467 if (res == NULL) { 467 if (res == NULL) {
468 /* 468 /*
469 * If we're out of memory this early, something is wrong, 469 * If we're out of memory this early, something is wrong,
@@ -471,7 +471,6 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
471 */ 471 */
472 panic("PCI: unable to allocate resources?\n"); 472 panic("PCI: unable to allocate resources?\n");
473 } 473 }
474 memset(res, 0, sizeof(*res) * 2);
475 474
476 local_write_config(PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); 475 local_write_config(PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
477 476