crypto: n2_core: insert '!err' condition in else scope
PATCH 1/1 crypto: n2_core: insert '!err' condition in else scope
This patch moves the '!err' condition into the above else scope, what is more obvious and has the secondary goal of avoid false-positives in statical analyze tools.
--- drivers/crypto/n2_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/n2_core.c +2 -2
@@ -1511,9 +1511,9 @@ static int __n2_register_one_ahash(const struct n2_hash_tmpl *tmpl)kfree (p); }else {pr_info ("%s alg registered\n" , base->cra_name); +if (p->hmac_type !=AUTH_TYPE_RESERVED ) + err =__n2_register_one_hmac (p); } -if (!err && p->hmac_type !=AUTH_TYPE_RESERVED ) - err =__n2_register_one_hmac (p);return err; }
Signature · 1 line
1.8.4
David Miller
maintainerFrom: "Geyslan G. Bem" <[email protected]>
Date: Sat, 19 Oct 2013 10:09:31 -0300
Quoted 5 lines
This patch moves the '!err' condition into the above else scope, what is more obvious and has the secondary goal of avoid false-positives in statical analyze tools.
Signed-off-by Geyslan G. Bem <[email protected]>
I do not think patches should be applied to satisfy tools if the code is semantically correct.
2013/10/19 David Miller <[email protected]>:
Quoted 11 lines
From: "Geyslan G. Bem" <[email protected]>
Date: Sat, 19 Oct 2013 10:09:31 -0300Quoted 5 lines
This patch moves the '!err' condition into the above else scope, what is more obvious and has the secondary goal of avoid false-positives in statical analyze tools.
Signed-off-by Geyslan G. Bem <[email protected]>I do not think patches should be applied to satisfy tools if the code is semantically correct.
Yes, Miller, I agree. But as I mentioned:
".. and has as the 'secondary' goal of avoid false-positives in statical analyze tools."
The 'primary' goal is to not repeat a condition test:
"This patch moves the '!err' condition into the above else scope, what is more obvious ..."
Thanks.
David Miller
maintainerFrom: Geyslan Gregório Bem <[email protected]>
Date: Sat, 19 Oct 2013 19:42:35 -0300
Quoted 13 lines
2013/10/19 David Miller <[email protected]>:
Quoted 11 lines
From: "Geyslan G. Bem" <[email protected]>
Date: Sat, 19 Oct 2013 10:09:31 -0300Quoted 5 lines
This patch moves the '!err' condition into the above else scope, what is more obvious and has the secondary goal of avoid false-positives in statical analyze tools.
Signed-off-by Geyslan G. Bem <[email protected]>I do not think patches should be applied to satisfy tools if the code is semantically correct.
Quoted 7 lines
Yes, Miller, I agree. But as I mentioned:
".. and has as the 'secondary' goal of avoid false-positives in statical analyze tools."The 'primary' goal is to not repeat a condition test:
"This patch moves the '!err' condition into the above else scope, what is more obvious ..."
I still do not feel that this change is a net-positive. Sorry.
2013/10/19 David Miller <[email protected]>:
Quoted 20 lines
From: Geyslan Gregório Bem <[email protected]>
Date: Sat, 19 Oct 2013 19:42:35 -0300Quoted 17 lines
2013/10/19 David Miller <[email protected]>:
Quoted 11 lines
From: "Geyslan G. Bem" <[email protected]>
Date: Sat, 19 Oct 2013 10:09:31 -0300Quoted 5 lines
This patch moves the '!err' condition into the above else scope, what is more obvious and has the secondary goal of avoid false-positives in statical analyze tools.
Signed-off-by Geyslan G. Bem <[email protected]>I do not think patches should be applied to satisfy tools if the code is semantically correct.
Yes, Miller, I agree. But as I mentioned:
".. and has as the 'secondary' goal of avoid false-positives in statical analyze tools."
Quoted 5 lines
Quoted 3 lines
The 'primary' goal is to not repeat a condition test:
"This patch moves the '!err' condition into the above else scope, what is more obvious ..."I still do not feel that this change is a net-positive. Sorry.
Miller,
I can understand you. You don't want to break your git history (blame). But when a code is clearly more readable/understandable you must assume that it has a huge net-positive.
The patch improves the code in three ways:
- Only one if/else;
- Not blame on static analysis tools.
- And avoid more discussion about that in the future (nobody will send patches like this to disturb you about that part of code).
The decision is yours.
Thanks again.
Quoted 5 lines · Geyslan Gregório Bem
I can understand you. You don't want to break your git history (blame). But when a code is clearly more readable/understandable you must assume that it has a huge net-positive.
Quoted 7 lines
The patch improves the code in three ways:
- Only one if/else;
- Not blame on static analysis tools.
- And avoid more discussion about that in the future (nobody will send patches like this to disturb you about that part of code).The decision is yours.
FWIW I totally agree with David so your patch isn't going in. Sorry.
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