Skip to content

Commit 02e9406

Browse files
Thippeswamy Havaligegregkh
authored andcommitted
PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe
[ Upstream commit 57b0302 ] 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] Signed-off-by: Sasha Levin <[email protected]>
1 parent 362b587 commit 02e9406

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
@@ -570,15 +570,17 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
570570
return err;
571571

572572
bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
573-
if (!bus)
574-
return -ENODEV;
573+
if (!bus) {
574+
err = -ENODEV;
575+
goto err_free_irq_domains;
576+
}
575577

576578
port->variant = of_device_get_match_data(dev);
577579

578580
err = xilinx_cpm_pcie_parse_dt(port, bus->res);
579581
if (err) {
580582
dev_err(dev, "Parsing DT failed\n");
581-
goto err_parse_dt;
583+
goto err_free_irq_domains;
582584
}
583585

584586
xilinx_cpm_pcie_init_port(port);
@@ -602,7 +604,7 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
602604
xilinx_cpm_free_interrupts(port);
603605
err_setup_irq:
604606
pci_ecam_free(port->cfg);
605-
err_parse_dt:
607+
err_free_irq_domains:
606608
xilinx_cpm_free_irq_domains(port);
607609
return err;
608610
}

0 commit comments

Comments
 (0)