提交 19fdb800 编写于 作者: R Russell King 提交者: Bjorn Helgaas

PCI: mvebu: Use devm_kcalloc() to allocate an array

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: NRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
上级 4a2eae23
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册