PCI: Drop references acquired by of_parse_phandle()
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 4 Aug 2015 19:54:04 +0000 (14:54 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 20 Aug 2015 17:02:50 +0000 (12:02 -0500)
of_parse_phandle() returns a device_node pointer with the refcount
incremented.  We should dispose of this reference when we're finished.

Drop the reference acquired by of_parse_phandle().

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
drivers/pci/host/pci-mvebu.c
drivers/pci/host/pci-xgene.c

index 70aa09556ec5ce3b5866766b7c7fec7bab332b19..67ec5e1c99dbbb75a6f14943b25539ca50dc0f1e 100644 (file)
@@ -879,6 +879,7 @@ static void mvebu_pcie_msi_enable(struct mvebu_pcie *pcie)
                return;
 
        pcie->msi = of_pci_find_msi_chip_by_node(msi_node);
+       of_node_put(msi_node);
 
        if (pcie->msi)
                pcie->msi->dev = &pcie->pdev->dev;
index a9dfb70d623ae0acbb54d96ada58a68ecc3074fe..4c2fb1f78d62f512d2d6f055fd6a95b95a8d1c63 100644 (file)
@@ -514,6 +514,7 @@ static int xgene_pcie_msi_enable(struct pci_bus *bus)
        if (!bus->msi)
                return -ENODEV;
 
+       of_node_put(msi_node);
        bus->msi->dev = &bus->dev;
        return 0;
 }