vgaarb: use kzalloc in vga_arbiter_add_pci_device()

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Rasmus Villemoes 2015-09-30 21:57:06 +02:00 committed by Daniel Vetter
parent fa4270d8e0
commit 945ef5bb14
1 changed files with 1 additions and 3 deletions

View File

@ -531,7 +531,7 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
return false; return false;
/* Allocate structure */ /* Allocate structure */
vgadev = kmalloc(sizeof(struct vga_device), GFP_KERNEL); vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL);
if (vgadev == NULL) { if (vgadev == NULL) {
pr_err("failed to allocate pci device\n"); pr_err("failed to allocate pci device\n");
/* /*
@ -541,8 +541,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
return false; return false;
} }
memset(vgadev, 0, sizeof(*vgadev));
/* Take lock & check for duplicates */ /* Take lock & check for duplicates */
spin_lock_irqsave(&vga_lock, flags); spin_lock_irqsave(&vga_lock, flags);
if (vgadev_find(pdev) != NULL) { if (vgadev_find(pdev) != NULL) {