2021-02-10 08:40:43

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] 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")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/crypto/keembay/keembay-ocs-hcu-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/keembay/keembay-ocs-hcu-core.c b/drivers/crypto/keembay/keembay-ocs-hcu-core.c
index c4b97b4160e9..322c51a6936f 100644
--- a/drivers/crypto/keembay/keembay-ocs-hcu-core.c
+++ b/drivers/crypto/keembay/keembay-ocs-hcu-core.c
@@ -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) {


2021-02-11 15:20:40

by Alessandrelli, Daniele

[permalink] [raw]
Subject: Re: [PATCH -next] crypto: keembay-ocs-hcu - Fix error return code in kmb_ocs_hcu_probe()

Hi Wei,

Thanks for the fix.

On Wed, 2021-02-10 at 07:43 +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: 472b04444cd3 ("crypto: keembay - Add Keem Bay OCS HCU driver")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> drivers/crypto/keembay/keembay-ocs-hcu-core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/keembay/keembay-ocs-hcu-core.c
> b/drivers/crypto/keembay/keembay-ocs-hcu-core.c
> index c4b97b4160e9..322c51a6936f 100644
> --- a/drivers/crypto/keembay/keembay-ocs-hcu-core.c
> +++ b/drivers/crypto/keembay/keembay-ocs-hcu-core.c
> @@ -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: Daniele Alessandrelli <[email protected]>