crypto: n2_core - 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 <u.kleine-koenig@pengutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Uwe Kleine-König 2023-10-20 09:55:50 +02:00 committed by Herbert Xu
parent fdfe6c3248
commit a0061b93c6

View File

@ -2011,7 +2011,7 @@ out_free_n2cp:
return err;
}
static int n2_crypto_remove(struct platform_device *dev)
static void n2_crypto_remove(struct platform_device *dev)
{
struct n2_crypto *np = dev_get_drvdata(&dev->dev);
@ -2022,8 +2022,6 @@ static int n2_crypto_remove(struct platform_device *dev)
release_global_resources();
free_n2cp(np);
return 0;
}
static struct n2_mau *alloc_ncp(void)
@ -2109,7 +2107,7 @@ out_free_ncp:
return err;
}
static int n2_mau_remove(struct platform_device *dev)
static void n2_mau_remove(struct platform_device *dev)
{
struct n2_mau *mp = dev_get_drvdata(&dev->dev);
@ -2118,8 +2116,6 @@ static int n2_mau_remove(struct platform_device *dev)
release_global_resources();
free_ncp(mp);
return 0;
}
static const struct of_device_id n2_crypto_match[] = {
@ -2146,7 +2142,7 @@ static struct platform_driver n2_crypto_driver = {
.of_match_table = n2_crypto_match,
},
.probe = n2_crypto_probe,
.remove = n2_crypto_remove,
.remove_new = n2_crypto_remove,
};
static const struct of_device_id n2_mau_match[] = {
@ -2173,7 +2169,7 @@ static struct platform_driver n2_mau_driver = {
.of_match_table = n2_mau_match,
},
.probe = n2_mau_probe,
.remove = n2_mau_remove,
.remove_new = n2_mau_remove,
};
static struct platform_driver * const drivers[] = {