All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Santosh Shilimkar" <santosh.shilimkar@ti.com>,
	"Murali Karicheri" <m-karicheri2@ti.com>
Cc: Rob Herring <robh@kernel.org>,
	linux-pci@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 4/4] PCI: keystone: Don't put .probe callback in .init.text section
Date: Sun,  1 Oct 2023 19:02:54 +0200	[thread overview]
Message-ID: <20231001170254.2506508-5-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20231001170254.2506508-1-u.kleine-koenig@pengutronix.de>

The __init annotation makes the ks_pcie_probe() function disappear after
booting completes. However a device can also be bound later. In that
case ks_pcie_probe() is tried to be called but the backing memory is
likely already overwritten.

The right thing to do is do always have the probe callback available.
Note that the (wrong) __refdata annotation prevented this issue to be
noticed by modpost.

Fixes: 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pci/controller/dwc/pci-keystone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index eb3fa17b243f..0def919f89fa 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -1100,7 +1100,7 @@ static const struct of_device_id ks_pcie_of_match[] = {
 	{ },
 };
 
-static int __init ks_pcie_probe(struct platform_device *pdev)
+static int ks_pcie_probe(struct platform_device *pdev)
 {
 	const struct dw_pcie_host_ops *host_ops;
 	const struct dw_pcie_ep_ops *ep_ops;
@@ -1318,7 +1318,7 @@ static int ks_pcie_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static struct platform_driver ks_pcie_driver __refdata = {
+static struct platform_driver ks_pcie_driver = {
 	.probe  = ks_pcie_probe,
 	.remove = ks_pcie_remove,
 	.driver = {
-- 
2.40.1


  parent reply	other threads:[~2023-10-01 17:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-01 17:02 [PATCH 0/4] pci: Fix some section mismatches Uwe Kleine-König
2023-10-01 17:02 ` Uwe Kleine-König
2023-10-01 17:02 ` [PATCH 1/4] PCI: exynos: Don't put .remove callback in .exit.text section Uwe Kleine-König
2023-10-01 17:02   ` Uwe Kleine-König
2023-10-02  1:38   ` Alim Akhtar
2023-10-02  1:38     ` Alim Akhtar
2023-10-01 17:02 ` [PATCH 2/4] PCI: kirin: " Uwe Kleine-König
2023-10-02 22:12   ` Bjorn Helgaas
2023-10-03 10:15     ` Uwe Kleine-König
2023-10-03 20:23       ` Uwe Kleine-König
2023-10-03 20:40         ` Bjorn Helgaas
2023-10-04  8:16           ` Uwe Kleine-König
2023-10-01 17:02 ` [PATCH 3/4] PCI: keystone: " Uwe Kleine-König
2023-10-01 17:02 ` Uwe Kleine-König [this message]
2023-10-10 17:23 ` [PATCH 0/4] pci: Fix some section mismatches Bjorn Helgaas
2023-10-10 17:23   ` Bjorn Helgaas

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=20231001170254.2506508-5-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=bhelgaas@google.com \
    --cc=kernel@pengutronix.de \
    --cc=kw@linux.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=robh@kernel.org \
    --cc=santosh.shilimkar@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.