소스 검색

[SPARC]: 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>
Yan Burman 18 년 전
부모
커밋
c80892d150
4개의 변경된 파일5개의 추가작업 그리고 10개의 파일을 삭제
  1. 2 4
      arch/sparc/kernel/ioport.c
  2. 1 2
      arch/sparc/kernel/of_device.c
  3. 1 2
      arch/sparc/kernel/sun4d_irq.c
  4. 1 2
      arch/sparc/mm/io-unit.c

+ 2 - 4
arch/sparc/kernel/ioport.c

@@ -317,9 +317,8 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
 	if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
 	if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
 		goto err_nopages;
 		goto err_nopages;
 
 
-	if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
+	if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
 		goto err_nomem;
 		goto err_nomem;
-	memset((char*)res, 0, sizeof(struct resource));
 
 
 	if (allocate_resource(&_sparc_dvma, res, len_total,
 	if (allocate_resource(&_sparc_dvma, res, len_total,
 	    _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
 	    _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
@@ -589,12 +588,11 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t len, dma_addr_t *pba)
 		return NULL;
 		return NULL;
 	}
 	}
 
 
-	if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
+	if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
 		free_pages(va, order);
 		free_pages(va, order);
 		printk("pci_alloc_consistent: no core\n");
 		printk("pci_alloc_consistent: no core\n");
 		return NULL;
 		return NULL;
 	}
 	}
-	memset((char*)res, 0, sizeof(struct resource));
 
 
 	if (allocate_resource(&_sparc_dvma, res, len_total,
 	if (allocate_resource(&_sparc_dvma, res, len_total,
 	    _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
 	    _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {

+ 1 - 2
arch/sparc/kernel/of_device.c

@@ -793,10 +793,9 @@ struct of_device* of_platform_device_create(struct device_node *np,
 {
 {
 	struct of_device *dev;
 	struct of_device *dev;
 
 
-	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev)
 	if (!dev)
 		return NULL;
 		return NULL;
-	memset(dev, 0, sizeof(*dev));
 
 
 	dev->dev.parent = parent;
 	dev->dev.parent = parent;
 	dev->dev.bus = bus;
 	dev->dev.bus = bus;

+ 1 - 2
arch/sparc/kernel/sun4d_irq.c

@@ -545,8 +545,7 @@ void __init sun4d_init_sbi_irq(void)
 	nsbi = 0;
 	nsbi = 0;
 	for_each_sbus(sbus)
 	for_each_sbus(sbus)
 		nsbi++;
 		nsbi++;
-	sbus_actions = (struct sbus_action *)kmalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
-	memset (sbus_actions, 0, (nsbi * 8 * 4 * sizeof(struct sbus_action)));
+	sbus_actions = kzalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
 	for_each_sbus(sbus) {
 	for_each_sbus(sbus) {
 #ifdef CONFIG_SMP	
 #ifdef CONFIG_SMP	
 		extern unsigned char boot_cpu_id;
 		extern unsigned char boot_cpu_id;

+ 1 - 2
arch/sparc/mm/io-unit.c

@@ -41,9 +41,8 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus)
 	struct linux_prom_registers iommu_promregs[PROMREG_MAX];
 	struct linux_prom_registers iommu_promregs[PROMREG_MAX];
 	struct resource r;
 	struct resource r;
 
 
-	iounit = kmalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
+	iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
 
 
-	memset(iounit, 0, sizeof(*iounit));
 	iounit->limit[0] = IOUNIT_BMAP1_START;
 	iounit->limit[0] = IOUNIT_BMAP1_START;
 	iounit->limit[1] = IOUNIT_BMAP2_START;
 	iounit->limit[1] = IOUNIT_BMAP2_START;
 	iounit->limit[2] = IOUNIT_BMAPM_START;
 	iounit->limit[2] = IOUNIT_BMAPM_START;