aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorYan Burman <burman.yan@gmail.com>2006-11-30 20:13:09 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-10 05:40:18 -0500
commit982c2064d9a8b51404088d132489a25e2db807fd (patch)
tree984706a0496f4f8df7d3c861d32a6d899cfe5894 /arch/sparc64
parentd4accd60d23f3c8a576fd08b727f88096f42d445 (diff)
[SPARC64]: Replace kmalloc+memset with kzalloc
Replace kmalloc+memset with kzalloc Signed-off-by: Yan Burman <burman.yan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/chmc.c3
-rw-r--r--arch/sparc64/kernel/isa.c12
-rw-r--r--arch/sparc64/kernel/of_device.c3
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c16
4 files changed, 10 insertions, 24 deletions
diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc64/kernel/chmc.c
index 259f37e516f5..9699abeb9907 100644
--- a/arch/sparc64/kernel/chmc.c
+++ b/arch/sparc64/kernel/chmc.c
@@ -341,7 +341,7 @@ static void fetch_decode_regs(struct mctrl_info *mp)
341 341
342static int init_one_mctrl(struct device_node *dp) 342static int init_one_mctrl(struct device_node *dp)
343{ 343{
344 struct mctrl_info *mp = kmalloc(sizeof(*mp), GFP_KERNEL); 344 struct mctrl_info *mp = kzalloc(sizeof(*mp), GFP_KERNEL);
345 int portid = of_getintprop_default(dp, "portid", -1); 345 int portid = of_getintprop_default(dp, "portid", -1);
346 struct linux_prom64_registers *regs; 346 struct linux_prom64_registers *regs;
347 void *pval; 347 void *pval;
@@ -349,7 +349,6 @@ static int init_one_mctrl(struct device_node *dp)
349 349
350 if (!mp) 350 if (!mp)
351 return -1; 351 return -1;
352 memset(mp, 0, sizeof(*mp));
353 if (portid == -1) 352 if (portid == -1)
354 goto fail; 353 goto fail;
355 354
diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c
index f028e68b23f2..ad1c4f55420f 100644
--- a/arch/sparc64/kernel/isa.c
+++ b/arch/sparc64/kernel/isa.c
@@ -72,14 +72,12 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev)
72 struct linux_prom_registers *regs; 72 struct linux_prom_registers *regs;
73 struct sparc_isa_device *isa_dev; 73 struct sparc_isa_device *isa_dev;
74 74
75 isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); 75 isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL);
76 if (!isa_dev) { 76 if (!isa_dev) {
77 fatal_err("cannot allocate child isa_dev"); 77 fatal_err("cannot allocate child isa_dev");
78 prom_halt(); 78 prom_halt();
79 } 79 }
80 80
81 memset(isa_dev, 0, sizeof(*isa_dev));
82
83 /* Link it in to parent. */ 81 /* Link it in to parent. */
84 isa_dev->next = parent_isa_dev->child; 82 isa_dev->next = parent_isa_dev->child;
85 parent_isa_dev->child = isa_dev; 83 parent_isa_dev->child = isa_dev;
@@ -104,14 +102,12 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
104 struct linux_prom_registers *regs; 102 struct linux_prom_registers *regs;
105 struct sparc_isa_device *isa_dev; 103 struct sparc_isa_device *isa_dev;
106 104
107 isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); 105 isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL);
108 if (!isa_dev) { 106 if (!isa_dev) {
109 printk(KERN_DEBUG "ISA: cannot allocate isa_dev"); 107 printk(KERN_DEBUG "ISA: cannot allocate isa_dev");
110 return; 108 return;
111 } 109 }
112 110
113 memset(isa_dev, 0, sizeof(*isa_dev));
114
115 isa_dev->ofdev.node = dp; 111 isa_dev->ofdev.node = dp;
116 isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev; 112 isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev;
117 isa_dev->ofdev.dev.bus = &isa_bus_type; 113 isa_dev->ofdev.dev.bus = &isa_bus_type;
@@ -180,14 +176,12 @@ void __init isa_init(void)
180 pbm = pdev_cookie->pbm; 176 pbm = pdev_cookie->pbm;
181 dp = pdev_cookie->prom_node; 177 dp = pdev_cookie->prom_node;
182 178
183 isa_br = kmalloc(sizeof(*isa_br), GFP_KERNEL); 179 isa_br = kzalloc(sizeof(*isa_br), GFP_KERNEL);
184 if (!isa_br) { 180 if (!isa_br) {
185 printk(KERN_DEBUG "isa: cannot allocate sparc_isa_bridge"); 181 printk(KERN_DEBUG "isa: cannot allocate sparc_isa_bridge");
186 return; 182 return;
187 } 183 }
188 184
189 memset(isa_br, 0, sizeof(*isa_br));
190
191 isa_br->ofdev.node = dp; 185 isa_br->ofdev.node = dp;
192 isa_br->ofdev.dev.parent = &pdev->dev; 186 isa_br->ofdev.dev.parent = &pdev->dev;
193 isa_br->ofdev.dev.bus = &isa_bus_type; 187 isa_br->ofdev.dev.bus = &isa_bus_type;
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index 8cc14fc6b6f1..cec0eceae552 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -1007,10 +1007,9 @@ struct of_device* of_platform_device_create(struct device_node *np,
1007{ 1007{
1008 struct of_device *dev; 1008 struct of_device *dev;
1009 1009
1010 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 1010 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
1011 if (!dev) 1011 if (!dev)
1012 return NULL; 1012 return NULL;
1013 memset(dev, 0, sizeof(*dev));
1014 1013
1015 dev->dev.parent = parent; 1014 dev->dev.parent = parent;
1016 dev->dev.bus = bus; 1015 dev->dev.bus = bus;
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 03ad4c06758e..6b04794b7a97 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -798,7 +798,7 @@ static struct pci_ops pci_sun4v_ops = {
798static void pbm_scan_bus(struct pci_controller_info *p, 798static void pbm_scan_bus(struct pci_controller_info *p,
799 struct pci_pbm_info *pbm) 799 struct pci_pbm_info *pbm)
800{ 800{
801 struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL); 801 struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
802 802
803 if (!cookie) { 803 if (!cookie) {
804 prom_printf("%s: Critical allocation failure.\n", pbm->name); 804 prom_printf("%s: Critical allocation failure.\n", pbm->name);
@@ -806,7 +806,6 @@ static void pbm_scan_bus(struct pci_controller_info *p,
806 } 806 }
807 807
808 /* All we care about is the PBM. */ 808 /* All we care about is the PBM. */
809 memset(cookie, 0, sizeof(*cookie));
810 cookie->pbm = pbm; 809 cookie->pbm = pbm;
811 810
812 pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, p->pci_ops, pbm); 811 pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, p->pci_ops, pbm);
@@ -1048,12 +1047,11 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
1048 /* Allocate and initialize the free area map. */ 1047 /* Allocate and initialize the free area map. */
1049 sz = num_tsb_entries / 8; 1048 sz = num_tsb_entries / 8;
1050 sz = (sz + 7UL) & ~7UL; 1049 sz = (sz + 7UL) & ~7UL;
1051 iommu->arena.map = kmalloc(sz, GFP_KERNEL); 1050 iommu->arena.map = kzalloc(sz, GFP_KERNEL);
1052 if (!iommu->arena.map) { 1051 if (!iommu->arena.map) {
1053 prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n"); 1052 prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n");
1054 prom_halt(); 1053 prom_halt();
1055 } 1054 }
1056 memset(iommu->arena.map, 0, sz);
1057 iommu->arena.limit = num_tsb_entries; 1055 iommu->arena.limit = num_tsb_entries;
1058 1056
1059 sz = probe_existing_entries(pbm, iommu); 1057 sz = probe_existing_entries(pbm, iommu);
@@ -1164,24 +1162,20 @@ void sun4v_pci_init(struct device_node *dp, char *model_name)
1164 per_cpu(pci_iommu_batch, i).pglist = (u64 *) page; 1162 per_cpu(pci_iommu_batch, i).pglist = (u64 *) page;
1165 } 1163 }
1166 1164
1167 p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); 1165 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
1168 if (!p) 1166 if (!p)
1169 goto fatal_memory_error; 1167 goto fatal_memory_error;
1170 1168
1171 memset(p, 0, sizeof(*p)); 1169 iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
1172
1173 iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
1174 if (!iommu) 1170 if (!iommu)
1175 goto fatal_memory_error; 1171 goto fatal_memory_error;
1176 1172
1177 memset(iommu, 0, sizeof(*iommu));
1178 p->pbm_A.iommu = iommu; 1173 p->pbm_A.iommu = iommu;
1179 1174
1180 iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC); 1175 iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
1181 if (!iommu) 1176 if (!iommu)
1182 goto fatal_memory_error; 1177 goto fatal_memory_error;
1183 1178
1184 memset(iommu, 0, sizeof(*iommu));
1185 p->pbm_B.iommu = iommu; 1179 p->pbm_B.iommu = iommu;
1186 1180
1187 p->next = pci_controller_root; 1181 p->next = pci_controller_root;