From: Nathan Chancellor <nathan@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Marek Vasut" <marek.vasut+renesas@gmail.com>,
"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
"kernel test robot" <lkp@intel.com>,
"Kees Cook" <kees@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>
Subject: Re: [PATCH] PCI: rcar-host: Avoid objtool no-cfi warning in rcar_pcie_probe()
Date: Tue, 14 Oct 2025 01:32:09 -0700 [thread overview]
Message-ID: <20251014083209.GA2696801@ax162> (raw)
In-Reply-To: <CAMuHMdXZvoTyWcgRp6TnkybnKY4ekfO9aB33iumPVaR7wvEXkw@mail.gmail.com>
Hi Geert,
On Tue, Oct 14, 2025 at 09:16:58AM +0200, Geert Uytterhoeven wrote:
> On Mon, 13 Oct 2025 at 20:26, Nathan Chancellor <nathan@kernel.org> wrote:
> > ---
> > Another alternative is to make this driver depend on CONFIG_OF since it
> > clearly requires it but that would restrict compile testing so I went
> > with this first.
> > ---
> > drivers/pci/controller/pcie-rcar-host.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
> > index 213028052aa5..15514c9c1927 100644
> > --- a/drivers/pci/controller/pcie-rcar-host.c
> > +++ b/drivers/pci/controller/pcie-rcar-host.c
> > @@ -981,7 +981,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
> > goto err_clk_disable;
> >
> > host->phy_init_fn = of_device_get_match_data(dev);
> > - err = host->phy_init_fn(host);
> > + err = host->phy_init_fn ? host->phy_init_fn(host) : -ENODEV;
> > if (err) {
> > dev_err(dev, "failed to init PCIe PHY\n");
> > goto err_clk_disable;
>
> I am afraid you're playing a big game of whack-a-mole, since we tend
> to remove these checks, as they can never happen in practice (driver
> is probed from DT only, and all entries in rcar_pcie_of_match[] have
> a non-NULL .data member)...
Thanks for the input! Yeah, that is fair, as I alluded to in the scissor
area. We could just do
diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
index 41748d083b93..d8688abc5b27 100644
--- a/drivers/pci/controller/Kconfig
+++ b/drivers/pci/controller/Kconfig
@@ -243,6 +243,7 @@ config PCI_TEGRA
config PCIE_RCAR_HOST
bool "Renesas R-Car PCIe controller (host mode)"
depends on ARCH_RENESAS || COMPILE_TEST
+ depends on OF
depends on PCI_MSI
select IRQ_MSI_LIB
help
since it is required for the driver to function. Another alternative
would be something like either:
diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index 213028052aa5..c237e04392e6 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -941,6 +941,9 @@ static int rcar_pcie_probe(struct platform_device *pdev)
u32 data;
int err;
+ if (!IS_ENABLED(CONFIG_OF))
+ return -ENODEV;
+
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*host));
if (!bridge)
return -ENOMEM;
or
diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index 213028052aa5..2aee2e0d9a1d 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -980,8 +980,12 @@ static int rcar_pcie_probe(struct platform_device *pdev)
if (err)
goto err_clk_disable;
- host->phy_init_fn = of_device_get_match_data(dev);
- err = host->phy_init_fn(host);
+ if (IS_ENABLED(CONFIG_OF)) {
+ host->phy_init_fn = of_device_get_match_data(dev);
+ err = host->phy_init_fn(host);
+ } else {
+ err = -ENODEV;
+ }
if (err) {
dev_err(dev, "failed to init PCIe PHY\n");
goto err_clk_disable;
to keep the ability to compile test the driver without CONFIG_OF while
having no impact on the final object code and avoiding the NULL call. I
am open to other thoughts and ideas as well.
Cheers,
Nathan
next prev parent reply other threads:[~2025-10-14 8:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 18:25 [PATCH] PCI: rcar-host: Avoid objtool no-cfi warning in rcar_pcie_probe() Nathan Chancellor
2025-10-14 7:16 ` Geert Uytterhoeven
2025-10-14 8:32 ` Nathan Chancellor [this message]
2025-10-14 13:02 ` Manivannan Sadhasivam
2025-10-14 17:43 ` Nathan Chancellor
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=20251014083209.GA2696801@ax162 \
--to=nathan@kernel.org \
--cc=bhelgaas@google.com \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=kees@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=lpieralisi@kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mani@kernel.org \
--cc=marek.vasut+renesas@gmail.com \
--cc=peterz@infradead.org \
--cc=robh@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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