diff mbox series

[3/5] coresight: stm: Convert to platform remove callback returning void

Message ID 3fefa60744fc68c9c4b40aeb69e34cda22582c4b.1713858615.git.u.kleine-koenig@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series coresight: Convert to platform remove callback returning void | expand

Commit Message

Uwe Kleine-König April 23, 2024, 8:07 a.m. UTC
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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Fixes: 057256aaacc8 ("coresight: stm: Move ACPI support from AMBA driver to platform driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/hwtracing/coresight/coresight-stm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
index cbf7f17556f8..96b1a8cfee14 100644
--- a/drivers/hwtracing/coresight/coresight-stm.c
+++ b/drivers/hwtracing/coresight/coresight-stm.c
@@ -1014,18 +1014,17 @@  static int stm_platform_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int stm_platform_remove(struct platform_device *pdev)
+static void stm_platform_remove(struct platform_device *pdev)
 {
 	struct stm_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
 
 	if (WARN_ON(!drvdata))
-		return -ENODEV;
+		return;
 
 	__stm_remove(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	if (!IS_ERR_OR_NULL(drvdata->pclk))
 		clk_put(drvdata->pclk);
-	return 0;
 }
 
 #ifdef CONFIG_ACPI
@@ -1038,7 +1037,7 @@  MODULE_DEVICE_TABLE(acpi, stm_acpi_ids);
 
 static struct platform_driver stm_platform_driver = {
 	.probe	= stm_platform_probe,
-	.remove	= stm_platform_remove,
+	.remove_new = stm_platform_remove,
 	.driver	= {
 		.name			= "coresight-stm-platform",
 		.acpi_match_table	= ACPI_PTR(stm_acpi_ids),