Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

coresight: tpiu: Convert to platform remove callback returning void

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: 3d83d4d4904a ("coresight: tpiu: Move ACPI support from AMBA driver to platform driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/ad5e0d3ec081444a5ad04a7be277dde3afcb696b.1713858615.git.u.kleine-koenig@pengutronix.de

authored by

Uwe Kleine-König and committed by
Suzuki K Poulose
ba8c06fe 38a38da4

+3 -4
+3 -4
drivers/hwtracing/coresight/coresight-tpiu.c
··· 285 285 return ret; 286 286 } 287 287 288 - static int tpiu_platform_remove(struct platform_device *pdev) 288 + static void tpiu_platform_remove(struct platform_device *pdev) 289 289 { 290 290 struct tpiu_drvdata *drvdata = dev_get_drvdata(&pdev->dev); 291 291 292 292 if (WARN_ON(!drvdata)) 293 - return -ENODEV; 293 + return; 294 294 295 295 __tpiu_remove(&pdev->dev); 296 296 pm_runtime_disable(&pdev->dev); 297 297 if (!IS_ERR_OR_NULL(drvdata->pclk)) 298 298 clk_put(drvdata->pclk); 299 - return 0; 300 299 } 301 300 302 301 #ifdef CONFIG_ACPI ··· 308 309 309 310 static struct platform_driver tpiu_platform_driver = { 310 311 .probe = tpiu_platform_probe, 311 - .remove = tpiu_platform_remove, 312 + .remove_new = tpiu_platform_remove, 312 313 .driver = { 313 314 .name = "coresight-tpiu-platform", 314 315 .acpi_match_table = ACPI_PTR(tpiu_acpi_ids),