2019-03-18 09:54:50

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 0/5] PCI: dwc: Support remove

Currently, the PCI dwc host users don't support the remove, but nothing
prevent us from supporting it. To achieve this goal, we need to ensure
we can do necessary clean up work.

Changes since v2:
- address all Gustavo's comments
- add Gustavo's ACK to patch1, patch3, patch4

Changes since v1:
- address Bjorn's comments, I.E Capitalize, s/irq/IRQ/, s/msi/MSI/

Jisheng Zhang (5):
PCI: dwc: Fix dw_pcie_free_msi() if msi_irq is invalid
PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi()
PCI: dwc: Free MSI in the error code path of dw_pcie_host_init()
PCI: dwc: Use devm_pci_alloc_host_bridge() to simplify the code
PCI: dwc: Save root bus for driver remove

.../pci/controller/dwc/pcie-designware-host.c | 59 ++++++++++---------
drivers/pci/controller/dwc/pcie-designware.h | 2 +
2 files changed, 34 insertions(+), 27 deletions(-)

--
2.20.1



2019-03-18 09:55:31

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 1/5] PCI: dwc: Fix dw_pcie_free_msi() if msi_irq is invalid

We should check msi_irq before calling irq_set_chained_handler() and
irq_set_handler_data().

Signed-off-by: Jisheng Zhang <[email protected]>
Acked-by: Gustavo Pimentel <[email protected]>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 25087d3c9a82..1040939f45b4 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -298,8 +298,10 @@ int dw_pcie_allocate_domains(struct pcie_port *pp)

void dw_pcie_free_msi(struct pcie_port *pp)
{
- irq_set_chained_handler(pp->msi_irq, NULL);
- irq_set_handler_data(pp->msi_irq, NULL);
+ if (pp->msi_irq) {
+ irq_set_chained_handler(pp->msi_irq, NULL);
+ irq_set_handler_data(pp->msi_irq, NULL);
+ }

irq_domain_remove(pp->msi_domain);
irq_domain_remove(pp->irq_domain);
--
2.20.1


2019-03-18 09:57:00

by Jisheng Zhang

[permalink] [raw]
Subject: PCI: dwc: Free MSI in the error code path of dw_pcie_host_init()

If we ever did some msi related initializations, we need to call
dw_pcie_free_msi() in the error code path.

Signed-off-by: Jisheng Zhang <[email protected]>
Acked-by: Gustavo Pimentel <[email protected]>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index a71b874ae3c0..585080699675 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -483,7 +483,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (pp->ops->host_init) {
ret = pp->ops->host_init(pp);
if (ret)
- goto error;
+ goto err_free_msi;
}

pp->root_bus_nr = pp->busn->start;
@@ -497,7 +497,7 @@ int dw_pcie_host_init(struct pcie_port *pp)

ret = pci_scan_root_bus_bridge(bridge);
if (ret)
- goto error;
+ goto err_free_msi;

bus = bridge->bus;

@@ -513,6 +513,10 @@ int dw_pcie_host_init(struct pcie_port *pp)
pci_bus_add_devices(bus);
return 0;

+err_free_msi:
+ if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled() &&
+ !pp->ops->msi_host_init)
+ dw_pcie_free_msi(pp);
error:
pci_free_host_bridge(bridge);
return ret;
--
2.20.1


2019-03-18 09:57:15

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init()

If we ever did some msi related initializations, we need to call
dw_pcie_free_msi() in the error code path.

Signed-off-by: Jisheng Zhang <[email protected]>
Acked-by: Gustavo Pimentel <[email protected]>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index a71b874ae3c0..585080699675 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -483,7 +483,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (pp->ops->host_init) {
ret = pp->ops->host_init(pp);
if (ret)
- goto error;
+ goto err_free_msi;
}

pp->root_bus_nr = pp->busn->start;
@@ -497,7 +497,7 @@ int dw_pcie_host_init(struct pcie_port *pp)

ret = pci_scan_root_bus_bridge(bridge);
if (ret)
- goto error;
+ goto err_free_msi;

bus = bridge->bus;

@@ -513,6 +513,10 @@ int dw_pcie_host_init(struct pcie_port *pp)
pci_bus_add_devices(bus);
return 0;

+err_free_msi:
+ if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled() &&
+ !pp->ops->msi_host_init)
+ dw_pcie_free_msi(pp);
error:
pci_free_host_bridge(bridge);
return ret;
--
2.20.1


2019-03-18 09:57:15

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 2/5] PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi()

To avoid memory leak, we need to free the page for MSI in
dw_pcie_free_msi().

Signed-off-by: Jisheng Zhang <[email protected]>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++++----
drivers/pci/controller/dwc/pcie-designware.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 1040939f45b4..a71b874ae3c0 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -305,20 +305,24 @@ void dw_pcie_free_msi(struct pcie_port *pp)

irq_domain_remove(pp->msi_domain);
irq_domain_remove(pp->irq_domain);
+
+ if (pp->msi_page)
+ __free_page(pp->msi_page);
}

void dw_pcie_msi_init(struct pcie_port *pp)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct device *dev = pci->dev;
- struct page *page;
u64 msi_target;

- page = alloc_page(GFP_KERNEL);
- pp->msi_data = dma_map_page(dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE);
+ pp->msi_page = alloc_page(GFP_KERNEL);
+ pp->msi_data = dma_map_page(dev, pp->msi_page, 0, PAGE_SIZE,
+ DMA_FROM_DEVICE);
if (dma_mapping_error(dev, pp->msi_data)) {
dev_err(dev, "Failed to map MSI data\n");
- __free_page(page);
+ __free_page(pp->msi_page);
+ pp->msi_page = NULL;
return;
}
msi_target = (u64)pp->msi_data;
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 377f4c0b52da..6fb0a1879932 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -179,6 +179,7 @@ struct pcie_port {
struct irq_domain *irq_domain;
struct irq_domain *msi_domain;
dma_addr_t msi_data;
+ struct page *msi_page;
u32 num_vectors;
u32 irq_mask[MAX_MSI_CTRLS];
raw_spinlock_t lock;
--
2.20.1


2019-03-18 09:58:29

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 4/5] PCI: dwc: Use devm_pci_alloc_host_bridge() to simplify the code

Use devm_pci_alloc_host_bridge() to simplify the error code path.

Signed-off-by: Jisheng Zhang <[email protected]>
Acked-by: Gustavo Pimentel <[email protected]>
---
.../pci/controller/dwc/pcie-designware-host.c | 21 +++++++------------
1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 585080699675..68a9dac23b1b 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -358,7 +358,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
dev_err(dev, "Missing *config* reg space\n");
}

- bridge = pci_alloc_host_bridge(0);
+ bridge = devm_pci_alloc_host_bridge(dev, 0);
if (!bridge)
return -ENOMEM;

@@ -369,7 +369,7 @@ int dw_pcie_host_init(struct pcie_port *pp)

ret = devm_request_pci_bus_resources(dev, &bridge->windows);
if (ret)
- goto error;
+ return ret;

/* Get the I/O and memory ranges from DT */
resource_list_for_each_entry_safe(win, tmp, &bridge->windows) {
@@ -413,8 +413,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
resource_size(pp->cfg));
if (!pci->dbi_base) {
dev_err(dev, "Error with ioremap\n");
- ret = -ENOMEM;
- goto error;
+ return -ENOMEM;
}
}

@@ -425,8 +424,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp->cfg0_base, pp->cfg0_size);
if (!pp->va_cfg0_base) {
dev_err(dev, "Error with ioremap in function\n");
- ret = -ENOMEM;
- goto error;
+ return -ENOMEM;
}
}

@@ -436,8 +434,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp->cfg1_size);
if (!pp->va_cfg1_base) {
dev_err(dev, "Error with ioremap\n");
- ret = -ENOMEM;
- goto error;
+ return -ENOMEM;
}
}

@@ -460,14 +457,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp->num_vectors == 0) {
dev_err(dev,
"Invalid number of vectors\n");
- goto error;
+ return -EINVAL;
}
}

if (!pp->ops->msi_host_init) {
ret = dw_pcie_allocate_domains(pp);
if (ret)
- goto error;
+ return ret;

if (pp->msi_irq)
irq_set_chained_handler_and_data(pp->msi_irq,
@@ -476,7 +473,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
} else {
ret = pp->ops->msi_host_init(pp);
if (ret < 0)
- goto error;
+ return ret;
}
}

@@ -517,8 +514,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled() &&
!pp->ops->msi_host_init)
dw_pcie_free_msi(pp);
-error:
- pci_free_host_bridge(bridge);
return ret;
}

--
2.20.1


2019-03-18 10:00:56

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 5/5] PCI: dwc: Save root bus for driver remove

Currently dwc host doesn't support the remove, but nothing prevent us
from supporting it. Save the root bus for clean up work in driver
remove code path.

After this patch, the dwc host users could implement its remove as:

static int foo_pcie_remove(struct platform_device *pdev)
{
...
pci_stop_root_bus(pp->root_bus);
pci_remove_root_bus(pp->root_bus);
dw_pcie_free_msi(pp);
...
}

Signed-off-by: Jisheng Zhang <[email protected]>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++------
drivers/pci/controller/dwc/pcie-designware.h | 1 +
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 68a9dac23b1b..7e9dad7ba056 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -341,7 +341,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
struct device_node *np = dev->of_node;
struct platform_device *pdev = to_platform_device(dev);
struct resource_entry *win, *tmp;
- struct pci_bus *bus, *child;
+ struct pci_bus *child;
struct pci_host_bridge *bridge;
struct resource *cfg_res;
int ret;
@@ -496,18 +496,18 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (ret)
goto err_free_msi;

- bus = bridge->bus;
+ pp->root_bus = bridge->bus;

if (pp->ops->scan_bus)
pp->ops->scan_bus(pp);

- pci_bus_size_bridges(bus);
- pci_bus_assign_resources(bus);
+ pci_bus_size_bridges(pp->root_bus);
+ pci_bus_assign_resources(pp->root_bus);

- list_for_each_entry(child, &bus->children, node)
+ list_for_each_entry(child, &pp->root_bus->children, node)
pcie_bus_configure_settings(child);

- pci_bus_add_devices(bus);
+ pci_bus_add_devices(pp->root_bus);
return 0;

err_free_msi:
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 6fb0a1879932..adff0c713665 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -182,6 +182,7 @@ struct pcie_port {
struct page *msi_page;
u32 num_vectors;
u32 irq_mask[MAX_MSI_CTRLS];
+ struct pci_bus *root_bus;
raw_spinlock_t lock;
DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS);
};
--
2.20.1


2019-03-18 10:03:16

by Jisheng Zhang

[permalink] [raw]
Subject: Re: PCI: dwc: Free MSI in the error code path of dw_pcie_host_init()

On Mon, 18 Mar 2019 17:47:49 +0800 Jisheng Zhang wrote:

> If we ever did some msi related initializations, we need to call
> dw_pcie_free_msi() in the error code path.

Sorry, "PATCH" is missing in the email title, please ignore this one


2019-03-18 10:04:55

by Gustavo Pimentel

[permalink] [raw]
Subject: Re: [PATCH v3 2/5] PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi()

Hi,

On 18/03/2019 09:54, Jisheng Zhang wrote:
> To avoid memory leak, we need to free the page for MSI in
> dw_pcie_free_msi().
>
> Signed-off-by: Jisheng Zhang <[email protected]>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++++----
> drivers/pci/controller/dwc/pcie-designware.h | 1 +
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 1040939f45b4..a71b874ae3c0 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -305,20 +305,24 @@ void dw_pcie_free_msi(struct pcie_port *pp)
>
> irq_domain_remove(pp->msi_domain);
> irq_domain_remove(pp->irq_domain);
> +
> + if (pp->msi_page)
> + __free_page(pp->msi_page);
> }
>
> void dw_pcie_msi_init(struct pcie_port *pp)
> {
> struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> struct device *dev = pci->dev;
> - struct page *page;
> u64 msi_target;
>
> - page = alloc_page(GFP_KERNEL);
> - pp->msi_data = dma_map_page(dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE);
> + pp->msi_page = alloc_page(GFP_KERNEL);
> + pp->msi_data = dma_map_page(dev, pp->msi_page, 0, PAGE_SIZE,
> + DMA_FROM_DEVICE);
> if (dma_mapping_error(dev, pp->msi_data)) {
> dev_err(dev, "Failed to map MSI data\n");
> - __free_page(page);
> + __free_page(pp->msi_page);
> + pp->msi_page = NULL;
> return;
> }
> msi_target = (u64)pp->msi_data;
> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> index 377f4c0b52da..6fb0a1879932 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.h
> +++ b/drivers/pci/controller/dwc/pcie-designware.h
> @@ -179,6 +179,7 @@ struct pcie_port {
> struct irq_domain *irq_domain;
> struct irq_domain *msi_domain;
> dma_addr_t msi_data;
> + struct page *msi_page;
> u32 num_vectors;
> u32 irq_mask[MAX_MSI_CTRLS];
> raw_spinlock_t lock;
>

Acked-by: Gustavo Pimentel <[email protected]>

2019-03-18 10:10:20

by Gustavo Pimentel

[permalink] [raw]
Subject: Re: [PATCH v3 5/5] PCI: dwc: Save root bus for driver remove

Hi,

On 18/03/2019 09:58, Jisheng Zhang wrote:
> Currently dwc host doesn't support the remove, but nothing prevent us
> from supporting it. Save the root bus for clean up work in driver
> remove code path.
>
> After this patch, the dwc host users could implement its remove as:
>
> static int foo_pcie_remove(struct platform_device *pdev)
> {
> ...
> pci_stop_root_bus(pp->root_bus);
> pci_remove_root_bus(pp->root_bus);
> dw_pcie_free_msi(pp);
> ...
> }
>
> Signed-off-by: Jisheng Zhang <[email protected]>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++------
> drivers/pci/controller/dwc/pcie-designware.h | 1 +
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 68a9dac23b1b..7e9dad7ba056 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -341,7 +341,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
> struct device_node *np = dev->of_node;
> struct platform_device *pdev = to_platform_device(dev);
> struct resource_entry *win, *tmp;
> - struct pci_bus *bus, *child;
> + struct pci_bus *child;
> struct pci_host_bridge *bridge;
> struct resource *cfg_res;
> int ret;
> @@ -496,18 +496,18 @@ int dw_pcie_host_init(struct pcie_port *pp)
> if (ret)
> goto err_free_msi;
>
> - bus = bridge->bus;
> + pp->root_bus = bridge->bus;
>
> if (pp->ops->scan_bus)
> pp->ops->scan_bus(pp);
>
> - pci_bus_size_bridges(bus);
> - pci_bus_assign_resources(bus);
> + pci_bus_size_bridges(pp->root_bus);
> + pci_bus_assign_resources(pp->root_bus);
>
> - list_for_each_entry(child, &bus->children, node)
> + list_for_each_entry(child, &pp->root_bus->children, node)
> pcie_bus_configure_settings(child);
>
> - pci_bus_add_devices(bus);
> + pci_bus_add_devices(pp->root_bus);
> return 0;
>
> err_free_msi:
> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> index 6fb0a1879932..adff0c713665 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.h
> +++ b/drivers/pci/controller/dwc/pcie-designware.h
> @@ -182,6 +182,7 @@ struct pcie_port {
> struct page *msi_page;
> u32 num_vectors;
> u32 irq_mask[MAX_MSI_CTRLS];
> + struct pci_bus *root_bus;
> raw_spinlock_t lock;
> DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS);
> };
>

Acked-by: Gustavo Pimentel <[email protected]>


2019-03-28 17:10:57

by Robin Murphy

[permalink] [raw]
Subject: Re: [PATCH v3 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init()

On 18/03/2019 09:56, Jisheng Zhang wrote:
> If we ever did some msi related initializations, we need to call
> dw_pcie_free_msi() in the error code path.
>
> Signed-off-by: Jisheng Zhang <[email protected]>
> Acked-by: Gustavo Pimentel <[email protected]>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index a71b874ae3c0..585080699675 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -483,7 +483,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
> if (pp->ops->host_init) {
> ret = pp->ops->host_init(pp);
> if (ret)
> - goto error;
> + goto err_free_msi;
> }
>
> pp->root_bus_nr = pp->busn->start;
> @@ -497,7 +497,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
>
> ret = pci_scan_root_bus_bridge(bridge);
> if (ret)
> - goto error;
> + goto err_free_msi;
>
> bus = bridge->bus;
>
> @@ -513,6 +513,10 @@ int dw_pcie_host_init(struct pcie_port *pp)
> pci_bus_add_devices(bus);
> return 0;
>
> +err_free_msi:
> + if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled() &&

pci_msi_enabled() already has a stub for !CONFIG_PCI_MSI, so you
shouldn't need an explicit IS_ENABLED() here.

Robin.

> + !pp->ops->msi_host_init)
> + dw_pcie_free_msi(pp);
> error:
> pci_free_host_bridge(bridge);
> return ret;
>

2019-03-29 12:03:18

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH v3 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init()

On Thu, 28 Mar 2019 17:08:43 +0000 Robin Murphy wrote:

>
>
> On 18/03/2019 09:56, Jisheng Zhang wrote:
> > If we ever did some msi related initializations, we need to call
> > dw_pcie_free_msi() in the error code path.
> >
> > Signed-off-by: Jisheng Zhang <[email protected]>
> > Acked-by: Gustavo Pimentel <[email protected]>
> > ---
> > drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> > index a71b874ae3c0..585080699675 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> > @@ -483,7 +483,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
> > if (pp->ops->host_init) {
> > ret = pp->ops->host_init(pp);
> > if (ret)
> > - goto error;
> > + goto err_free_msi;
> > }
> >
> > pp->root_bus_nr = pp->busn->start;
> > @@ -497,7 +497,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
> >
> > ret = pci_scan_root_bus_bridge(bridge);
> > if (ret)
> > - goto error;
> > + goto err_free_msi;
> >
> > bus = bridge->bus;
> >
> > @@ -513,6 +513,10 @@ int dw_pcie_host_init(struct pcie_port *pp)
> > pci_bus_add_devices(bus);
> > return 0;
> >
> > +err_free_msi:
> > + if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled() &&
>
> pci_msi_enabled() already has a stub for !CONFIG_PCI_MSI, so you
> shouldn't need an explicit IS_ENABLED() here.

Indeed, thanks very much. updated in V4

Thanks