Commit 5c794301 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Jens Wiklander

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: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarSumit Garg <sumit.garg@linaro.org>
Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
parent 4cece764
...@@ -1433,7 +1433,7 @@ static optee_invoke_fn *get_invoke_func(struct device *dev) ...@@ -1433,7 +1433,7 @@ static optee_invoke_fn *get_invoke_func(struct device *dev)
* optee_remove is called by platform subsystem to alert the driver * optee_remove is called by platform subsystem to alert the driver
* that it should release the device * that it should release the device
*/ */
static int optee_smc_remove(struct platform_device *pdev) static void optee_smc_remove(struct platform_device *pdev)
{ {
struct optee *optee = platform_get_drvdata(pdev); struct optee *optee = platform_get_drvdata(pdev);
...@@ -1453,8 +1453,6 @@ static int optee_smc_remove(struct platform_device *pdev) ...@@ -1453,8 +1453,6 @@ static int optee_smc_remove(struct platform_device *pdev)
memunmap(optee->smc.memremaped_shm); memunmap(optee->smc.memremaped_shm);
kfree(optee); kfree(optee);
return 0;
} }
/* optee_shutdown - Device Removal Routine /* optee_shutdown - Device Removal Routine
...@@ -1806,7 +1804,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match); ...@@ -1806,7 +1804,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
static struct platform_driver optee_driver = { static struct platform_driver optee_driver = {
.probe = optee_probe, .probe = optee_probe,
.remove = optee_smc_remove, .remove_new = optee_smc_remove,
.shutdown = optee_shutdown, .shutdown = optee_shutdown,
.driver = { .driver = {
.name = "optee", .name = "optee",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment