浏览代码

[PATCH] sky2: use kzalloc

Can use kzalloc here.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Stephen Hemminger 19 年之前
父节点
当前提交
6aad85d673
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      drivers/net/sky2.c

+ 1 - 2
drivers/net/sky2.c

@@ -3099,14 +3099,13 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
 #endif
 #endif
 
 
 	err = -ENOMEM;
 	err = -ENOMEM;
-	hw = kmalloc(sizeof(*hw), GFP_KERNEL);
+	hw = kzalloc(sizeof(*hw), GFP_KERNEL);
 	if (!hw) {
 	if (!hw) {
 		printk(KERN_ERR PFX "%s: cannot allocate hardware struct\n",
 		printk(KERN_ERR PFX "%s: cannot allocate hardware struct\n",
 		       pci_name(pdev));
 		       pci_name(pdev));
 		goto err_out_free_regions;
 		goto err_out_free_regions;
 	}
 	}
 
 
-	memset(hw, 0, sizeof(*hw));
 	hw->pdev = pdev;
 	hw->pdev = pdev;
 
 
 	hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000);
 	hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000);