Skip to content

Commit 57b0302

Browse files
Thippeswamy Havaligekwilczynski
authored andcommitted
PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe
The IRQ domain allocated for the PCIe controller is not freed if resource_list_first_type() returns NULL, leading to a resource leak. This fix ensures properly cleaning up the allocated IRQ domain in the error path. Fixes: 49e427e ("Merge branch 'pci/host-probe-refactor'") Signed-off-by: Thippeswamy Havalige <[email protected]> [kwilczynski: added missing Fixes: tag, refactored to use one of the goto labels] Signed-off-by: Krzysztof Wilczyński <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2014c95 commit 57b0302

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/pci/controller/pcie-xilinx-cpm.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,15 +583,17 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
583583
return err;
584584

585585
bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
586-
if (!bus)
587-
return -ENODEV;
586+
if (!bus) {
587+
err = -ENODEV;
588+
goto err_free_irq_domains;
589+
}
588590

589591
port->variant = of_device_get_match_data(dev);
590592

591593
err = xilinx_cpm_pcie_parse_dt(port, bus->res);
592594
if (err) {
593595
dev_err(dev, "Parsing DT failed\n");
594-
goto err_parse_dt;
596+
goto err_free_irq_domains;
595597
}
596598

597599
xilinx_cpm_pcie_init_port(port);
@@ -615,7 +617,7 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
615617
xilinx_cpm_free_interrupts(port);
616618
err_setup_irq:
617619
pci_ecam_free(port->cfg);
618-
err_parse_dt:
620+
err_free_irq_domains:
619621
xilinx_cpm_free_irq_domains(port);
620622
return err;
621623
}

0 commit comments

Comments
 (0)