Skip to content

Commit f030304

Browse files
Yuuoniybjorn-helgaas
authored andcommitted
PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains()
of_get_next_child() returns a node pointer with refcount incremented, so we should use of_node_put() on it when we don't need it anymore. mc_pcie_init_irq_domains() only calls of_node_put() in the normal path, missing it in some error paths. Add missing of_node_put() to avoid refcount leak. Fixes: 6f15a9c ("PCI: microchip: Add Microchip PolarFire PCIe controller driver") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miaoqian Lin <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Rob Herring <[email protected]>
1 parent f2906aa commit f030304

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/pci/controller/pcie-microchip-host.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,7 @@ static int mc_pcie_init_irq_domains(struct mc_pcie *port)
904904
&event_domain_ops, port);
905905
if (!port->event_domain) {
906906
dev_err(dev, "failed to get event domain\n");
907+
of_node_put(pcie_intc_node);
907908
return -ENOMEM;
908909
}
909910

@@ -913,6 +914,7 @@ static int mc_pcie_init_irq_domains(struct mc_pcie *port)
913914
&intx_domain_ops, port);
914915
if (!port->intx_domain) {
915916
dev_err(dev, "failed to get an INTx IRQ domain\n");
917+
of_node_put(pcie_intc_node);
916918
return -ENOMEM;
917919
}
918920

0 commit comments

Comments
 (0)