From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: "Toan Le" <toan@os.amperecomputing.com>, "Lorenzo Pieralisi" <lpieralisi@kernel.org>, "Krzysztof Wilczyński" <kw@linux.com>, "Bjorn Helgaas" <bhelgaas@google.com> Cc: Rob Herring <robh@kernel.org>, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 15/15] PCI: xgene-msi: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:08 +0100 [thread overview] Message-ID: <20230321193208.366561-16-u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/pci/controller/pci-xgene-msi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c index d7987b281f79..0234e528b9a5 100644 --- a/drivers/pci/controller/pci-xgene-msi.c +++ b/drivers/pci/controller/pci-xgene-msi.c @@ -348,7 +348,7 @@ static void xgene_msi_isr(struct irq_desc *desc) static enum cpuhp_state pci_xgene_online; -static int xgene_msi_remove(struct platform_device *pdev) +static void xgene_msi_remove(struct platform_device *pdev) { struct xgene_msi *msi = platform_get_drvdata(pdev); @@ -362,8 +362,6 @@ static int xgene_msi_remove(struct platform_device *pdev) msi->bitmap = NULL; xgene_free_domains(msi); - - return 0; } static int xgene_msi_hwirq_alloc(unsigned int cpu) @@ -521,7 +519,7 @@ static struct platform_driver xgene_msi_driver = { .of_match_table = xgene_msi_match_table, }, .probe = xgene_msi_probe, - .remove = xgene_msi_remove, + .remove_new = xgene_msi_remove, }; static int __init xgene_pcie_msi_init(void) -- 2.39.2
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: "Toan Le" <toan@os.amperecomputing.com>, "Lorenzo Pieralisi" <lpieralisi@kernel.org>, "Krzysztof Wilczyński" <kw@linux.com>, "Bjorn Helgaas" <bhelgaas@google.com> Cc: Rob Herring <robh@kernel.org>, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 15/15] PCI: xgene-msi: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:08 +0100 [thread overview] Message-ID: <20230321193208.366561-16-u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/pci/controller/pci-xgene-msi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c index d7987b281f79..0234e528b9a5 100644 --- a/drivers/pci/controller/pci-xgene-msi.c +++ b/drivers/pci/controller/pci-xgene-msi.c @@ -348,7 +348,7 @@ static void xgene_msi_isr(struct irq_desc *desc) static enum cpuhp_state pci_xgene_online; -static int xgene_msi_remove(struct platform_device *pdev) +static void xgene_msi_remove(struct platform_device *pdev) { struct xgene_msi *msi = platform_get_drvdata(pdev); @@ -362,8 +362,6 @@ static int xgene_msi_remove(struct platform_device *pdev) msi->bitmap = NULL; xgene_free_domains(msi); - - return 0; } static int xgene_msi_hwirq_alloc(unsigned int cpu) @@ -521,7 +519,7 @@ static struct platform_driver xgene_msi_driver = { .of_match_table = xgene_msi_match_table, }, .probe = xgene_msi_probe, - .remove = xgene_msi_remove, + .remove_new = xgene_msi_remove, }; static int __init xgene_pcie_msi_init(void) -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-03-21 19:33 UTC|newest] Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-21 19:31 [PATCH 00/15] PCI: Convert to platform remove callback returning void Uwe Kleine-König 2023-03-21 19:31 ` Uwe Kleine-König 2023-03-21 19:31 ` Uwe Kleine-König 2023-03-21 19:31 ` [PATCH 01/15] PCI: aardvark: " Uwe Kleine-König 2023-03-21 19:31 ` Uwe Kleine-König 2023-03-21 19:36 ` Pali Rohár 2023-03-21 19:36 ` Pali Rohár 2023-03-21 21:08 ` Uwe Kleine-König 2023-03-21 21:08 ` Uwe Kleine-König 2023-03-21 19:31 ` [PATCH 02/15] PCI: altera: " Uwe Kleine-König 2023-03-21 19:31 ` [PATCH 03/15] PCI: altera-msi: " Uwe Kleine-König 2023-03-21 19:31 ` [PATCH 04/15] PCI: brcmstb: " Uwe Kleine-König 2023-03-21 19:31 ` Uwe Kleine-König 2023-03-21 21:37 ` Florian Fainelli 2023-03-21 21:37 ` Florian Fainelli 2023-03-21 19:31 ` [PATCH 05/15] PCI: cadence/j721e: " Uwe Kleine-König 2023-03-21 19:31 ` Uwe Kleine-König 2023-03-21 19:31 ` [PATCH 06/15] PCI: dwc/*: " Uwe Kleine-König 2023-03-22 18:06 ` Serge Semin 2023-03-21 19:32 ` [PATCH 07/15] PCI: hisi-error: " Uwe Kleine-König 2023-03-21 19:32 ` [PATCH 08/15] PCI: iproc: " Uwe Kleine-König 2023-03-21 19:32 ` Uwe Kleine-König 2023-03-21 21:37 ` Florian Fainelli 2023-03-21 21:37 ` Florian Fainelli 2023-03-21 19:32 ` [PATCH 09/15] PCI: mediatek: " Uwe Kleine-König 2023-03-21 19:32 ` Uwe Kleine-König 2023-03-21 19:32 ` [PATCH 10/15] PCI: mediatek-gen3: " Uwe Kleine-König 2023-03-21 19:32 ` Uwe Kleine-König 2023-03-21 19:32 ` [PATCH 11/15] PCI: mt7621: " Uwe Kleine-König 2023-03-21 19:32 ` Uwe Kleine-König 2023-03-22 6:40 ` Sergio Paracuellos 2023-03-22 6:40 ` Sergio Paracuellos 2023-03-21 19:32 ` [PATCH 12/15] PCI: mvebu: " Uwe Kleine-König 2023-03-21 19:32 ` Uwe Kleine-König 2023-03-21 19:32 ` [PATCH 13/15] PCI: rockchip-host: " Uwe Kleine-König 2023-03-21 19:32 ` Uwe Kleine-König 2023-03-21 19:32 ` Uwe Kleine-König 2023-03-21 19:32 ` [PATCH 14/15] PCI: tegra: " Uwe Kleine-König 2023-03-21 19:32 ` Uwe Kleine-König [this message] 2023-03-21 19:32 ` [PATCH 15/15] PCI: xgene-msi: " Uwe Kleine-König 2023-05-30 14:07 ` [PATCH 00/15] PCI: " Uwe Kleine-König 2023-05-30 14:07 ` Uwe Kleine-König 2023-05-30 14:07 ` Uwe Kleine-König 2023-06-02 21:37 ` Bjorn Helgaas 2023-06-02 21:37 ` Bjorn Helgaas 2023-06-02 21:37 ` Bjorn Helgaas 2023-06-06 16:02 ` Uwe Kleine-König 2023-06-06 16:02 ` Uwe Kleine-König 2023-06-06 16:02 ` Uwe Kleine-König 2023-06-24 14:23 ` Krzysztof Wilczyński 2023-06-24 14:23 ` Krzysztof Wilczyński 2023-06-24 14:23 ` Krzysztof Wilczyński 2023-06-11 13:24 ` Pali Rohár 2023-06-11 13:24 ` Pali Rohár 2023-06-12 16:19 ` Bjorn Helgaas 2023-06-12 16:19 ` Bjorn Helgaas 2023-06-12 16:19 ` Bjorn Helgaas 2023-06-12 18:17 ` Pali Rohár 2023-06-12 18:17 ` Pali Rohár 2023-06-12 18:17 ` Pali Rohár 2023-06-24 14:19 ` Krzysztof Wilczyński 2023-06-24 14:19 ` Krzysztof Wilczyński 2023-06-24 14:19 ` Krzysztof Wilczyński
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=20230321193208.366561-16-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-arm-kernel@lists.infradead.org \ --cc=linux-pci@vger.kernel.org \ --cc=lpieralisi@kernel.org \ --cc=robh@kernel.org \ --cc=toan@os.amperecomputing.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: linkBe 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.