]> git.dujemihanovic.xyz Git - linux.git/commitdiff
crypto: n2_core - Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 20 Oct 2023 07:55:50 +0000 (09:55 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 27 Oct 2023 10:04:26 +0000 (18:04 +0800)
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>
drivers/crypto/n2_core.c

index d5a32d71a3e970b7943d5c4985440e4ce0a79dc1..caea98622c33628915aecd9db275f9d16f4003fd 100644 (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[] = {