diff mbox series

[v1] crypto: caam - use traditional error check pattern

Message ID 20200831075832.3827-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [v1] crypto: caam - use traditional error check pattern | expand

Commit Message

Andy Shevchenko Aug. 31, 2020, 7:58 a.m. UTC
Use traditional error check pattern
	ret = ...;
	if (ret)
		return ret;
	...
instead of checking error code to be 0.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/crypto/caam/ctrl.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Iuliana Prodan Sept. 1, 2020, 3:05 p.m. UTC | #1
On 8/31/2020 10:58 AM, Andy Shevchenko wrote:
> Use traditional error check pattern
> 	ret = ...;
> 	if (ret)
> 		return ret;
> 	...
> instead of checking error code to be 0.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>

> ---
>   drivers/crypto/caam/ctrl.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
> index 65de57f169d9..25785404a58e 100644
> --- a/drivers/crypto/caam/ctrl.c
> +++ b/drivers/crypto/caam/ctrl.c
> @@ -333,11 +333,10 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
>   
>   	kfree(desc);
>   
> -	if (!ret)
> -		ret = devm_add_action_or_reset(ctrldev, devm_deinstantiate_rng,
> -					       ctrldev);
> +	if (ret)
> +		return ret;
>   
> -	return ret;
> +	return devm_add_action_or_reset(ctrldev, devm_deinstantiate_rng, ctrldev);
>   }
>   
>   /*
>
Herbert Xu Sept. 11, 2020, 6:57 a.m. UTC | #2
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Use traditional error check pattern
>        ret = ...;
>        if (ret)
>                return ret;
>        ...
> instead of checking error code to be 0.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/crypto/caam/ctrl.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 65de57f169d9..25785404a58e 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -333,11 +333,10 @@  static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
 
 	kfree(desc);
 
-	if (!ret)
-		ret = devm_add_action_or_reset(ctrldev, devm_deinstantiate_rng,
-					       ctrldev);
+	if (ret)
+		return ret;
 
-	return ret;
+	return devm_add_action_or_reset(ctrldev, devm_deinstantiate_rng, ctrldev);
 }
 
 /*