]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.51/pci-dwc-free-msi-in-dw_pcie_host_init-error-path.patch
Linux 5.1.10
[thirdparty/kernel/stable-queue.git] / releases / 4.19.51 / pci-dwc-free-msi-in-dw_pcie_host_init-error-path.patch
1 From a418222f35367bb7ad3014e6ca1a93f2fe1cf369 Mon Sep 17 00:00:00 2001
2 From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
3 Date: Fri, 29 Mar 2019 11:57:54 +0000
4 Subject: PCI: dwc: Free MSI in dw_pcie_host_init() error path
5
6 [ Upstream commit 9e2b5de5604a6ff2626c51e77014d92c9299722c ]
7
8 If we ever did MSI-related initializations, we need to call
9 dw_pcie_free_msi() in the error code path.
10
11 Remove the IS_ENABLED(CONFIG_PCI_MSI) check for MSI init because
12 pci_msi_enabled() already has a stub for !CONFIG_PCI_MSI.
13
14 Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
15 Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
16 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
17 Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
18 Signed-off-by: Sasha Levin <sashal@kernel.org>
19 ---
20 drivers/pci/controller/dwc/pcie-designware-host.c | 9 ++++++---
21 1 file changed, 6 insertions(+), 3 deletions(-)
22
23 diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
24 index b56e22262a77..4eedb2c54ab3 100644
25 --- a/drivers/pci/controller/dwc/pcie-designware-host.c
26 +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
27 @@ -439,7 +439,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
28 if (ret)
29 pci->num_viewport = 2;
30
31 - if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled()) {
32 + if (pci_msi_enabled()) {
33 /*
34 * If a specific SoC driver needs to change the
35 * default number of vectors, it needs to implement
36 @@ -477,7 +477,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
37 if (pp->ops->host_init) {
38 ret = pp->ops->host_init(pp);
39 if (ret)
40 - goto error;
41 + goto err_free_msi;
42 }
43
44 pp->root_bus_nr = pp->busn->start;
45 @@ -491,7 +491,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
46
47 ret = pci_scan_root_bus_bridge(bridge);
48 if (ret)
49 - goto error;
50 + goto err_free_msi;
51
52 bus = bridge->bus;
53
54 @@ -507,6 +507,9 @@ int dw_pcie_host_init(struct pcie_port *pp)
55 pci_bus_add_devices(bus);
56 return 0;
57
58 +err_free_msi:
59 + if (pci_msi_enabled() && !pp->ops->msi_host_init)
60 + dw_pcie_free_msi(pp);
61 error:
62 pci_free_host_bridge(bridge);
63 return ret;
64 --
65 2.20.1
66