[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250319171814.GA1047025@bhelgaas>
Date: Wed, 19 Mar 2025 12:18:14 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Ioana Ciornei <ioana.ciornei@....com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>, Frank Li <Frank.Li@....com>,
Jingoo Han <jingoohan1@...il.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>, kw@...ux.com,
Rob Herring <robh@...nel.org>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PCI: dwc: don't assume the ops field in dw_pcie always
exists
On Wed, Mar 19, 2025 at 03:43:39PM +0200, Ioana Ciornei wrote:
> The blamed commit assumes that the ops field from dw_pcie is always
> populated. This is not the case for the layerscape-pcie driver which
> does not provide a dw_pcie_ops structure. The newly added
> dw_pcie_parent_bus_offset() function tries to dereference pci->ops
> which, in this case, is NULL.
>
> Fix this by first checking if pci->ops is valid before dereferencing it.
>
> Fixes: ed6509230934 ("PCI: dwc: Add dw_pcie_parent_bus_offset() checking and debug")
> Signed-off-by: Ioana Ciornei <ioana.ciornei@....com>
Thank you very much! Squashed into the "PCI: dwc: Add
dw_pcie_parent_bus_offset() checking and debug" commit so there will
be no bisection hole for this.
> ---
> drivers/pci/controller/dwc/pcie-designware.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> index e68e2aac210f..b5fd44c0d6ad 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.c
> +++ b/drivers/pci/controller/dwc/pcie-designware.c
> @@ -1170,7 +1170,7 @@ resource_size_t dw_pcie_parent_bus_offset(struct dw_pcie *pci,
>
> of_property_read_reg(np, index, ®_addr, NULL);
>
> - fixup = pci->ops->cpu_addr_fixup;
> + fixup = pci->ops ? pci->ops->cpu_addr_fixup : 0;
> if (fixup) {
> fixup_addr = fixup(pci, cpu_phy_addr);
> if (reg_addr == fixup_addr) {
> --
> 2.34.1
>
Powered by blists - more mailing lists