Skip to content

Commit

Permalink
PCI: mvebu: Use devm_kcalloc() to allocate an array
Browse files Browse the repository at this point in the history
Rather than using devm_kzalloc() and multiplying the element and number,
use the provided devm_kcalloc() helper for this.

Tested-by: Willy Tarreau <w@1wt.eu> (Iomega iConnect Kirkwood, MiraBox Armada 370)
Tested-by: Andrew Lunn <andrew@lunn.ch> (D-Link DIR664 Kirkwood)
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> (Armada XP GP)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  • Loading branch information
Russell King authored and Bjorn Helgaas committed Oct 9, 2015
1 parent 4a2eae2 commit 19fdb80
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/pci/host/pci-mvebu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,8 +1075,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)

num = of_get_available_child_count(pdev->dev.of_node);

pcie->ports = devm_kzalloc(&pdev->dev, num *
sizeof(struct mvebu_pcie_port),
pcie->ports = devm_kcalloc(&pdev->dev, num, sizeof(*pcie->ports),
GFP_KERNEL);
if (!pcie->ports)
return -ENOMEM;
Expand Down

0 comments on commit 19fdb80

Please sign in to comment.