From patchwork Sun Oct 1 17:02:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13405443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 331ACE748E9 for ; Sun, 1 Oct 2023 17:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qWScyibJ2oXTmMgUBZb6g9sXsRZAa0jEg6xRrcKArwI=; b=DAl7XoT9feG433 Bdip9KAp5sZ7s4IAGxSi8WsflrbSLgKtCoN2b0ATdezbWu39XAEt5NspPvVMxellS+DjMv3t0/lIW vYO5kJqgJ1wmYSJ2FVPf5HXV/UjDgNCIdl/bLUrcDkGMM2TIeCi0iakyOjHRD+haYjOE7iwPqmlGs 8JzZ1Rb4OpinB37rIykyDblf7Vy6CrHdaCYx+Hh1S6xpW/cbIcD1MdjHinJFPUeKkFFc6d2UyTCpx k+3DoSzz05kF+zqf1wgqthUIwZrdJlyNvM8A0TDREBlh1wgss6HILX2Y7Ss5CYkVV6JgiyHycRysL pDPONcIebeS6gwwdilvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qmzqu-00BQsy-0b; Sun, 01 Oct 2023 17:03:32 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qmzqr-00BQrf-0Z for linux-arm-kernel@lists.infradead.org; Sun, 01 Oct 2023 17:03:30 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qmzqS-0005BF-PV; Sun, 01 Oct 2023 19:03:04 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qmzqM-00AKTW-E4; Sun, 01 Oct 2023 19:02:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qmzqM-0079nP-4b; Sun, 01 Oct 2023 19:02:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jingoo Han , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas , Krzysztof Kozlowski , Kukjin Kim , Siva Reddy Kallam , Surendranath Gurivireddy Balla Cc: Rob Herring , Alim Akhtar , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 1/4] PCI: exynos: Don't put .remove callback in .exit.text section Date: Sun, 1 Oct 2023 19:02:51 +0200 Message-Id: <20231001170254.2506508-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231001170254.2506508-1-u.kleine-koenig@pengutronix.de> References: <20231001170254.2506508-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1702; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=OoB8V0QN2YibVFa/pOcDY8n94rmziBnKkvfd2aYMT2s=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlGaY4WoQOHcFdBW70op0DsB7a0aHbc76X9IrOy 7eIIAcsLyyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRmmOAAKCRCPgPtYfRL+ TjcVCACY4BPKl48mzPmYqDljwCPyRIyCeg+us3NyvvSoE3Pnb9v1cHyeeGmTGrcF64inCFWWHcw fPOgiF1Enprc+xZQZXyqr2V1E8baAV7jlDYN+d3hizbi6L157BI5DOgog10EplgsLB1sgYn9R7P YAYmUi79sPqKLg9TagPO4LM2FZF+DTbyJStkbRpPVXITsRDbwC1cb9zBXbS1+JGoKyQhqADc7FT 5BefF3GO1Ei+b13cW3mTkp7p+iUaoFxWYFSAqxYC83F3wMmuUsavXCNIhZ4qXSrCOPBl90VR5Bv 7occyEzH9nC3oLBaaqYV2mEP+sVa9csXVcysgiQz7jBAuAXc X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231001_100329_216952_CF658D3B X-CRM114-Status: GOOD ( 17.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With CONFIG_PCI_EXYNOS=y and exynos_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. The right thing to do is do always have the remove callback available. This fixes the following warning by modpost: WARNING: modpost: drivers/pci/controller/dwc/pci-exynos: section mismatch in reference: exynos_pcie_driver+0x8 (section: .data) -> exynos_pcie_remove (section: .exit.text) (with ARCH=x86_64 W=1 allmodconfig). Fixes: 340cba6092c2 ("pci: Add PCIe driver for Samsung Exynos") Signed-off-by: Uwe Kleine-König Reviewed-by: Alim Akhtar --- drivers/pci/controller/dwc/pci-exynos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c index 6319082301d6..c6bede346932 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -375,7 +375,7 @@ static int exynos_pcie_probe(struct platform_device *pdev) return ret; } -static int __exit exynos_pcie_remove(struct platform_device *pdev) +static int exynos_pcie_remove(struct platform_device *pdev) { struct exynos_pcie *ep = platform_get_drvdata(pdev); @@ -431,7 +431,7 @@ static const struct of_device_id exynos_pcie_of_match[] = { static struct platform_driver exynos_pcie_driver = { .probe = exynos_pcie_probe, - .remove = __exit_p(exynos_pcie_remove), + .remove = exynos_pcie_remove, .driver = { .name = "exynos-pcie", .of_match_table = exynos_pcie_of_match,