Skip to content

Commit

Permalink
vgaarb: use kzalloc in vga_arbiter_add_pci_device()
Browse files Browse the repository at this point in the history
Signed-off-by: Rasmus Villemoes <[email protected]>
Reviewed-by: Jani Nikula <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
  • Loading branch information
Villemoes authored and danvet committed Oct 1, 2015
1 parent fa4270d commit 945ef5b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/gpu/vga/vgaarb.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
return false;

/* Allocate structure */
vgadev = kmalloc(sizeof(struct vga_device), GFP_KERNEL);
vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL);
if (vgadev == NULL) {
pr_err("failed to allocate pci device\n");
/*
Expand All @@ -541,8 +541,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
return false;
}

memset(vgadev, 0, sizeof(*vgadev));

/* Take lock & check for duplicates */
spin_lock_irqsave(&vga_lock, flags);
if (vgadev_find(pdev) != NULL) {
Expand Down

0 comments on commit 945ef5b

Please sign in to comment.