Skip to contentSkip to conversation

crypto: keembay-ocs-aes - Fix error return code in kmb_ocs_aes_probe()

PATCH In review Wei Yongjun 3 participants 3 messages Feb 10, 2021 – Mar 4, 2021 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: keembay-ocs-aes - Fix error return code in kmb_ocs_aes_probe()

Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.

Fixes 885743324513 ("crypto: keembay - Add support for Keem Bay OCS AES/SM4")
---
 drivers/crypto/keembay/keembay-ocs-aes-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/keembay/keembay-ocs-aes-core.c +3 -1
index b6b25d994af3..2ef312866338 100644
@@ -1649,8 +1649,10 @@ static int kmb_ocs_aes_probe(struct platform_device *pdev)
 
 	/* Initialize crypto engine */
 	aes_dev->engine = crypto_engine_alloc_init(dev, true);
-	if (!aes_dev->engine)
+	if (!aes_dev->engine) {
+		rc = -ENOMEM;
 		goto list_del;
+	}
 
 	rc = crypto_engine_start(aes_dev->engine);
 	if (rc) {
Reviewed-by on v1 1/1
#1 lore raw

Hi Wei,

Thanks for this fix as well :)

Quoted 28 lines · Wei Yongjun

Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.

Fixes 885743324513 ("crypto: keembay - Add support for Keem Bay OCS

AES/SM4")

---
 drivers/crypto/keembay/keembay-ocs-aes-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/keembay/keembay-ocs-aes-core.c +3 -1
index b6b25d994af3..2ef312866338 100644
@@ -1649,8 +1649,10 @@ static int kmb_ocs_aes_probe(struct
 platform_device *pdev)
 
 	/* Initialize crypto engine */
 	aes_dev->engine = crypto_engine_alloc_init(dev, true);
-	if (!aes_dev->engine)
+	if (!aes_dev->engine) {
+		rc = -ENOMEM;
 		goto list_del;
+	}
 
 	rc = crypto_engine_start(aes_dev->engine);
Quoted 2 lines

if (rc) {

maintainer
#2 lore raw
In reply to Wei Yongjun
Quoted 9 lines · Wei Yongjun

Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.

Fixes 885743324513 ("crypto: keembay - Add support for Keem Bay OCS AES/SM4")
---
 drivers/crypto/keembay/keembay-ocs-aes-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt