public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: s5p-sss - use unregister_{ahashes,skciphers} in probe/remove
@ 2026-03-17  8:04 Thorsten Blum
  2026-03-19 16:55 ` Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-03-17  8:04 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Vladimir Zapolskiy, Herbert Xu,
	David S. Miller
  Cc: Thorsten Blum, linux-crypto, linux-samsung-soc, linux-kernel

Replace multiple for loops with calls to crypto_unregister_ahashes() and
crypto_unregister_skciphers().

If crypto_register_skcipher() fails in s5p_aes_probe(), log the error
directly instead of checking 'i < ARRAY_SIZE(algs)' later.  Also drop
now-unused local index variables.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/s5p-sss.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index eece1ff6c62f..bdda7b39af85 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -2131,7 +2131,7 @@ static struct skcipher_alg algs[] = {
 static int s5p_aes_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	int i, j, err;
+	int i, err;
 	const struct samsung_aes_variant *variant;
 	struct s5p_aes_dev *pdata;
 	struct resource *res;
@@ -2237,8 +2237,11 @@ static int s5p_aes_probe(struct platform_device *pdev)
 
 	for (i = 0; i < ARRAY_SIZE(algs); i++) {
 		err = crypto_register_skcipher(&algs[i]);
-		if (err)
+		if (err) {
+			dev_err(dev, "can't register '%s': %d\n",
+				algs[i].base.cra_name, err);
 			goto err_algs;
+		}
 	}
 
 	if (pdata->use_hash) {
@@ -2265,20 +2268,12 @@ static int s5p_aes_probe(struct platform_device *pdev)
 	return 0;
 
 err_hash:
-	for (j = hash_i - 1; j >= 0; j--)
-		crypto_unregister_ahash(&algs_sha1_md5_sha256[j]);
-
+	crypto_unregister_ahashes(algs_sha1_md5_sha256, hash_i);
 	tasklet_kill(&pdata->hash_tasklet);
 	res->end -= 0x300;
 
 err_algs:
-	if (i < ARRAY_SIZE(algs))
-		dev_err(dev, "can't register '%s': %d\n", algs[i].base.cra_name,
-			err);
-
-	for (j = 0; j < i; j++)
-		crypto_unregister_skcipher(&algs[j]);
-
+	crypto_unregister_skciphers(algs, i);
 	tasklet_kill(&pdata->tasklet);
 
 err_irq:
@@ -2294,15 +2289,13 @@ static int s5p_aes_probe(struct platform_device *pdev)
 static void s5p_aes_remove(struct platform_device *pdev)
 {
 	struct s5p_aes_dev *pdata = platform_get_drvdata(pdev);
-	int i;
 
-	for (i = 0; i < ARRAY_SIZE(algs); i++)
-		crypto_unregister_skcipher(&algs[i]);
+	crypto_unregister_skciphers(algs, ARRAY_SIZE(algs));
 
 	tasklet_kill(&pdata->tasklet);
 	if (pdata->use_hash) {
-		for (i = ARRAY_SIZE(algs_sha1_md5_sha256) - 1; i >= 0; i--)
-			crypto_unregister_ahash(&algs_sha1_md5_sha256[i]);
+		crypto_unregister_ahashes(algs_sha1_md5_sha256,
+					  ARRAY_SIZE(algs_sha1_md5_sha256));
 
 		pdata->res->end -= 0x300;
 		tasklet_kill(&pdata->hash_tasklet);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: s5p-sss - use unregister_{ahashes,skciphers} in probe/remove
  2026-03-17  8:04 [PATCH] crypto: s5p-sss - use unregister_{ahashes,skciphers} in probe/remove Thorsten Blum
@ 2026-03-19 16:55 ` Krzysztof Kozlowski
  2026-03-19 20:02 ` Vladimir Zapolskiy
  2026-03-27 10:05 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-19 16:55 UTC (permalink / raw)
  To: Thorsten Blum, Vladimir Zapolskiy, Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-samsung-soc, linux-kernel

On 17/03/2026 09:04, Thorsten Blum wrote:
> Replace multiple for loops with calls to crypto_unregister_ahashes() and
> crypto_unregister_skciphers().
> 
> If crypto_register_skcipher() fails in s5p_aes_probe(), log the error
> directly instead of checking 'i < ARRAY_SIZE(algs)' later.  Also drop
> now-unused local index variables.  No functional changes.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/s5p-sss.c | 27 ++++++++++-----------------
>  1 file changed, 10 insertions(+), 17 deletions(-)


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: s5p-sss - use unregister_{ahashes,skciphers} in probe/remove
  2026-03-17  8:04 [PATCH] crypto: s5p-sss - use unregister_{ahashes,skciphers} in probe/remove Thorsten Blum
  2026-03-19 16:55 ` Krzysztof Kozlowski
@ 2026-03-19 20:02 ` Vladimir Zapolskiy
  2026-03-27 10:05 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Zapolskiy @ 2026-03-19 20:02 UTC (permalink / raw)
  To: Thorsten Blum, Herbert Xu, David S. Miller
  Cc: Krzysztof Kozlowski, linux-crypto, linux-samsung-soc,
	linux-kernel

On 3/17/26 10:04, Thorsten Blum wrote:
> Replace multiple for loops with calls to crypto_unregister_ahashes() and
> crypto_unregister_skciphers().
> 
> If crypto_register_skcipher() fails in s5p_aes_probe(), log the error
> directly instead of checking 'i < ARRAY_SIZE(algs)' later.  Also drop
> now-unused local index variables.  No functional changes.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>

-- 
Best wishes,
Vladimir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: s5p-sss - use unregister_{ahashes,skciphers} in probe/remove
  2026-03-17  8:04 [PATCH] crypto: s5p-sss - use unregister_{ahashes,skciphers} in probe/remove Thorsten Blum
  2026-03-19 16:55 ` Krzysztof Kozlowski
  2026-03-19 20:02 ` Vladimir Zapolskiy
@ 2026-03-27 10:05 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2026-03-27 10:05 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Krzysztof Kozlowski, Vladimir Zapolskiy, David S. Miller,
	linux-crypto, linux-samsung-soc, linux-kernel

On Tue, Mar 17, 2026 at 09:04:52AM +0100, Thorsten Blum wrote:
> Replace multiple for loops with calls to crypto_unregister_ahashes() and
> crypto_unregister_skciphers().
> 
> If crypto_register_skcipher() fails in s5p_aes_probe(), log the error
> directly instead of checking 'i < ARRAY_SIZE(algs)' later.  Also drop
> now-unused local index variables.  No functional changes.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/s5p-sss.c | 27 ++++++++++-----------------
>  1 file changed, 10 insertions(+), 17 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-27 10:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17  8:04 [PATCH] crypto: s5p-sss - use unregister_{ahashes,skciphers} in probe/remove Thorsten Blum
2026-03-19 16:55 ` Krzysztof Kozlowski
2026-03-19 20:02 ` Vladimir Zapolskiy
2026-03-27 10:05 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox