From: Bjorn Helgaas <helgaas@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "Xiaowei Song" <songxiaowei@hisilicon.com>,
"Binghui Wang" <wangbinghui@hisilicon.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Kishon Vijay Abraham I" <kishon@ti.com>,
"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
"Rob Herring" <robh@kernel.org>,
linux-pci@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH 2/4] PCI: kirin: Don't put .remove callback in .exit.text section
Date: Mon, 2 Oct 2023 17:12:18 -0500 [thread overview]
Message-ID: <20231002221218.GA651790@bhelgaas> (raw)
In-Reply-To: <20231001170254.2506508-3-u.kleine-koenig@pengutronix.de>
On Sun, Oct 01, 2023 at 07:02:52PM +0200, Uwe Kleine-König wrote:
> With CONFIG_PCIE_KIRIN=y and kirin_pcie_remove() marked with __exit, the
> function is discarded from the driver. In this case a bound device can
> still get unbound, e.g via sysfs. Then no cleanup code is run resulting
> in resource leaks or worse.
kirin_pcie_driver sets .suppress_bind_attrs = true.
Doesn't that mean that we can't unbind a device via sysfs in this
case?
I don't expect modpost to know about .suppress_bind_attrs, so maybe we
should remove the __exit annotation even if it would be safe to keep
it in this case. It's a tiny function anyway.
> The right thing to do is do always have the remove callback available.
> This fixes the following warning by modpost:
>
> drivers/pci/controller/dwc/pcie-kirin: section mismatch in reference: kirin_pcie_driver+0x8 (section: .data) -> kirin_pcie_remove (section: .exit.text)
>
> (with ARCH=x86_64 W=1 allmodconfig).
>
> Fixes: 000f60db784b ("PCI: kirin: Add support for a PHY layer")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/pci/controller/dwc/pcie-kirin.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
> index d93bc2906950..2ee146767971 100644
> --- a/drivers/pci/controller/dwc/pcie-kirin.c
> +++ b/drivers/pci/controller/dwc/pcie-kirin.c
> @@ -741,7 +741,7 @@ static int kirin_pcie_power_on(struct platform_device *pdev,
> return ret;
> }
>
> -static int __exit kirin_pcie_remove(struct platform_device *pdev)
> +static int kirin_pcie_remove(struct platform_device *pdev)
> {
> struct kirin_pcie *kirin_pcie = platform_get_drvdata(pdev);
>
> @@ -818,7 +818,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
>
> static struct platform_driver kirin_pcie_driver = {
> .probe = kirin_pcie_probe,
> - .remove = __exit_p(kirin_pcie_remove),
> + .remove = kirin_pcie_remove,
> .driver = {
> .name = "kirin-pcie",
> .of_match_table = kirin_pcie_match,
> --
> 2.40.1
>
next prev parent reply other threads:[~2023-10-02 22:12 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 [this message]
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 ` [PATCH 4/4] PCI: keystone: Don't put .probe callback in .init.text section Uwe Kleine-König
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=20231002221218.GA651790@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=kernel@pengutronix.de \
--cc=kishon@ti.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=robh@kernel.org \
--cc=songxiaowei@hisilicon.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wangbinghui@hisilicon.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.