.../pci/controller/dwc/pcie-designware-host.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
From: Bjorn Helgaas <bhelgaas@google.com>
If platform_get_resource_byname("config") fails, return error immediately
and unindent the normal path. No functional change intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
.../pci/controller/dwc/pcie-designware-host.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index e42a74108f0f..3fca55751dca 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -436,18 +436,18 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
return ret;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config");
- if (res) {
- pp->cfg0_size = resource_size(res);
- pp->cfg0_base = res->start;
-
- pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res);
- if (IS_ERR(pp->va_cfg0_base))
- return PTR_ERR(pp->va_cfg0_base);
- } else {
+ if (!res) {
dev_err(dev, "Missing *config* reg space\n");
return -ENODEV;
}
+ pp->cfg0_size = resource_size(res);
+ pp->cfg0_base = res->start;
+
+ pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res);
+ if (IS_ERR(pp->va_cfg0_base))
+ return PTR_ERR(pp->va_cfg0_base);
+
bridge = devm_pci_alloc_host_bridge(dev, 0);
if (!bridge)
return -ENOMEM;
--
2.34.1
On Fri, Jan 17, 2025 at 05:51:19PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> If platform_get_resource_byname("config") fails, return error immediately
> and unindent the normal path. No functional change intended.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
One nit below.
> ---
> .../pci/controller/dwc/pcie-designware-host.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index e42a74108f0f..3fca55751dca 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -436,18 +436,18 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
> return ret;
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config");
> - if (res) {
> - pp->cfg0_size = resource_size(res);
> - pp->cfg0_base = res->start;
> -
> - pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res);
> - if (IS_ERR(pp->va_cfg0_base))
> - return PTR_ERR(pp->va_cfg0_base);
> - } else {
> + if (!res) {
> dev_err(dev, "Missing *config* reg space\n");
nit: How about:
"Missing \"config\" reg space"?
- Mani
--
மணிவண்ணன் சதாசிவம்
On Fri, Jan 17, 2025 at 05:51:19PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> If platform_get_resource_byname("config") fails, return error immediately
> and unindent the normal path. No functional change intended.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> .../pci/controller/dwc/pcie-designware-host.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index e42a74108f0f..3fca55751dca 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -436,18 +436,18 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
> return ret;
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config");
> - if (res) {
> - pp->cfg0_size = resource_size(res);
> - pp->cfg0_base = res->start;
> -
> - pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res);
> - if (IS_ERR(pp->va_cfg0_base))
> - return PTR_ERR(pp->va_cfg0_base);
> - } else {
> + if (!res) {
> dev_err(dev, "Missing *config* reg space\n");
> return -ENODEV;
> }
>
> + pp->cfg0_size = resource_size(res);
> + pp->cfg0_base = res->start;
> +
> + pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res);
> + if (IS_ERR(pp->va_cfg0_base))
> + return PTR_ERR(pp->va_cfg0_base);
> +
> bridge = devm_pci_alloc_host_bridge(dev, 0);
> if (!bridge)
> return -ENOMEM;
> --
> 2.34.1
>
© 2016 - 2026 Red Hat, Inc.