[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z4whAeajxo04DhGr@lizhi-Precision-Tower-5810>
Date: Sat, 18 Jan 2025 16:45:37 -0500
From: Frank Li <Frank.li@....com>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: Jingoo Han <jingoohan1@...il.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Rob Herring <robh@...nel.org>, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH] PCI: dwc: Simplify config resource lookup
On Fri, Jan 17, 2025 at 05:51:19PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@...gle.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@...gle.com>
Reviewed-by: Frank Li <Frank.Li@....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
>
Powered by blists - more mailing lists