From: Bjorn Helgaas <helgaas@kernel.org>
To: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>, Frank Li <Frank.Li@nxp.com>,
Jingoo Han <jingoohan1@gmail.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
kw@linux.com, Rob Herring <robh@kernel.org>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: dwc: don't assume the ops field in dw_pcie always exists
Date: Wed, 19 Mar 2025 12:18:14 -0500 [thread overview]
Message-ID: <20250319171814.GA1047025@bhelgaas> (raw)
In-Reply-To: <20250319134339.3114817-1-ioana.ciornei@nxp.com>
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@nxp.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
>
prev parent reply other threads:[~2025-03-19 17:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 13:43 [PATCH] PCI: dwc: don't assume the ops field in dw_pcie always exists Ioana Ciornei
2025-03-19 14:06 ` Frank Li
2025-03-19 17:18 ` Bjorn Helgaas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250319171814.GA1047025@bhelgaas \
--to=helgaas@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=bhelgaas@google.com \
--cc=ioana.ciornei@nxp.com \
--cc=jingoohan1@gmail.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox