Skip to content

Commit 5c79430

Browse files
Uwe Kleine-Königjenswi-linaro
authored andcommitted
tee: optee: smc: 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. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Signed-off-by: Jens Wiklander <[email protected]>
1 parent 4cece76 commit 5c79430

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/tee/optee/smc_abi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ static optee_invoke_fn *get_invoke_func(struct device *dev)
14331433
* optee_remove is called by platform subsystem to alert the driver
14341434
* that it should release the device
14351435
*/
1436-
static int optee_smc_remove(struct platform_device *pdev)
1436+
static void optee_smc_remove(struct platform_device *pdev)
14371437
{
14381438
struct optee *optee = platform_get_drvdata(pdev);
14391439

@@ -1453,8 +1453,6 @@ static int optee_smc_remove(struct platform_device *pdev)
14531453
memunmap(optee->smc.memremaped_shm);
14541454

14551455
kfree(optee);
1456-
1457-
return 0;
14581456
}
14591457

14601458
/* optee_shutdown - Device Removal Routine
@@ -1806,7 +1804,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
18061804

18071805
static struct platform_driver optee_driver = {
18081806
.probe = optee_probe,
1809-
.remove = optee_smc_remove,
1807+
.remove_new = optee_smc_remove,
18101808
.shutdown = optee_shutdown,
18111809
.driver = {
18121810
.name = "optee",

0 commit comments

Comments
 (0)