diff mbox series

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

Message ID 20210210074527.867400-1-weiyongjun1@huawei.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [-next] crypto: keembay-ocs-aes - Fix error return code in kmb_ocs_aes_probe() | expand

Commit Message

Wei Yongjun Feb. 10, 2021, 7:45 a.m. UTC
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")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/crypto/keembay/keembay-ocs-aes-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Alessandrelli, Daniele Feb. 11, 2021, 3:13 p.m. UTC | #1
Hi Wei,

Thanks for this fix as well :)

On Wed, 2021-02-10 at 07:45 +0000, Wei Yongjun wrote:
> 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")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/crypto/keembay/keembay-ocs-aes-core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/keembay/keembay-ocs-aes-core.c
> b/drivers/crypto/keembay/keembay-ocs-aes-core.c
> index b6b25d994af3..2ef312866338 100644
> --- a/drivers/crypto/keembay/keembay-ocs-aes-core.c
> +++ b/drivers/crypto/keembay/keembay-ocs-aes-core.c
> @@ -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: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Herbert Xu March 4, 2021, 6:42 a.m. UTC | #2
On Wed, Feb 10, 2021 at 07:45:27AM +0000, Wei Yongjun wrote:
> 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")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/crypto/keembay/keembay-ocs-aes-core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/keembay/keembay-ocs-aes-core.c b/drivers/crypto/keembay/keembay-ocs-aes-core.c
index b6b25d994af3..2ef312866338 100644
--- a/drivers/crypto/keembay/keembay-ocs-aes-core.c
+++ b/drivers/crypto/keembay/keembay-ocs-aes-core.c
@@ -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) {