Skip to content

Commit

Permalink
PCI: Allocate dma_alias_mask with bitmap_zalloc()
Browse files Browse the repository at this point in the history
Switch to bitmap_zalloc() to show clearly what we are allocating.  Besides
that it returns pointer of bitmap type ("unsigned long *") instead of the
opaque "void *".

Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
  • Loading branch information
andy-shev authored and bjorn-helgaas committed Sep 17, 2018
1 parent 1ccce46 commit c663579
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -5690,8 +5690,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
void pci_add_dma_alias(struct pci_dev *dev, u8 devfn)
{
if (!dev->dma_alias_mask)
dev->dma_alias_mask = kcalloc(BITS_TO_LONGS(U8_MAX),
sizeof(long), GFP_KERNEL);
dev->dma_alias_mask = bitmap_zalloc(U8_MAX, GFP_KERNEL);
if (!dev->dma_alias_mask) {
pci_warn(dev, "Unable to allocate DMA alias mask\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ static void pci_release_dev(struct device *dev)
pcibios_release_device(pci_dev);
pci_bus_put(pci_dev->bus);
kfree(pci_dev->driver_override);
kfree(pci_dev->dma_alias_mask);
bitmap_free(pci_dev->dma_alias_mask);
kfree(pci_dev);
}

Expand Down

0 comments on commit c663579

Please sign in to comment.