PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe
[ Upstream commit 57b0302240741e73fe51f88404b3866e0d2933ad ] 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: 49e427e6bdd1 ("Merge branch 'pci/host-probe-refactor'") Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com> [kwilczynski: added missing Fixes: tag, refactored to use one of the goto labels] Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Link: https://lore.kernel.org/r/20250224155025.782179-2-thippeswamy.havalige@amd.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
defab1c652
commit
a4d0b76c65
@ -595,15 +595,17 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
|
bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
|
||||||
if (!bus)
|
if (!bus) {
|
||||||
return -ENODEV;
|
err = -ENODEV;
|
||||||
|
goto err_free_irq_domains;
|
||||||
|
}
|
||||||
|
|
||||||
port->variant = of_device_get_match_data(dev);
|
port->variant = of_device_get_match_data(dev);
|
||||||
|
|
||||||
err = xilinx_cpm_pcie_parse_dt(port, bus->res);
|
err = xilinx_cpm_pcie_parse_dt(port, bus->res);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(dev, "Parsing DT failed\n");
|
dev_err(dev, "Parsing DT failed\n");
|
||||||
goto err_parse_dt;
|
goto err_free_irq_domains;
|
||||||
}
|
}
|
||||||
|
|
||||||
xilinx_cpm_pcie_init_port(port);
|
xilinx_cpm_pcie_init_port(port);
|
||||||
@ -627,7 +629,7 @@ err_host_bridge:
|
|||||||
xilinx_cpm_free_interrupts(port);
|
xilinx_cpm_free_interrupts(port);
|
||||||
err_setup_irq:
|
err_setup_irq:
|
||||||
pci_ecam_free(port->cfg);
|
pci_ecam_free(port->cfg);
|
||||||
err_parse_dt:
|
err_free_irq_domains:
|
||||||
xilinx_cpm_free_irq_domains(port);
|
xilinx_cpm_free_irq_domains(port);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user