Skip to contentSkip to conversation

crypto: keembay-ocs-hcu - Fix error return code in kmb_ocs_hcu_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-hcu - Fix error return code in kmb_ocs_hcu_probe()

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

Fixes 472b04444cd3 ("crypto: keembay - Add Keem Bay OCS HCU driver")
---
 drivers/crypto/keembay/keembay-ocs-hcu-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/keembay/keembay-ocs-hcu-core.c +3 -1
index c4b97b4160e9..322c51a6936f 100644
@@ -1220,8 +1220,10 @@ static int kmb_ocs_hcu_probe(struct platform_device *pdev)
 
 	/* Initialize crypto engine */
 	hcu_dev->engine = crypto_engine_alloc_init(dev, 1);
-	if (!hcu_dev->engine)
+	if (!hcu_dev->engine) {
+		rc = -ENOMEM;
 		goto list_del;
+	}
 
 	rc = crypto_engine_start(hcu_dev->engine);
 	if (rc) {
Reviewed-by on v1 1/1
#1 lore raw

Hi Wei,

Thanks for the fix.

Quoted 27 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 472b04444cd3 ("crypto: keembay - Add Keem Bay OCS HCU driver")
---
 drivers/crypto/keembay/keembay-ocs-hcu-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/keembay/keembay-ocs-hcu-core.c +3 -1
index c4b97b4160e9..322c51a6936f 100644
@@ -1220,8 +1220,10 @@ static int kmb_ocs_hcu_probe(struct
 platform_device *pdev)
 
 	/* Initialize crypto engine */
 	hcu_dev->engine = crypto_engine_alloc_init(dev, 1);
-	if (!hcu_dev->engine)
+	if (!hcu_dev->engine) {
+		rc = -ENOMEM;
 		goto list_del;
+	}
 
 	rc = crypto_engine_start(hcu_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 472b04444cd3 ("crypto: keembay - Add Keem Bay OCS HCU driver")
---
 drivers/crypto/keembay/keembay-ocs-hcu-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