diff mbox series

[net-next,5/5] net/smc: return booleans instead of integers

Message ID 20180126082850.20655-6-ubraun@linux.vnet.ibm.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series net/smc: fixes 2018-01-26 | expand

Commit Message

Ursula Braun Jan. 26, 2018, 8:28 a.m. UTC
From: Gustavo A. R. Silva <gustavo@embeddedor.com>

Return statements in functions returning bool should use
true/false instead of 1/0.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bart Van Assche Jan. 26, 2018, 3:57 p.m. UTC | #1
On Fri, 2018-01-26 at 09:28 +0100, Ursula Braun wrote:
> From: Gustavo A. R. Silva <gustavo@embeddedor.com>

> 

> Return statements in functions returning bool should use

> true/false instead of 1/0.

> 

> This issue was detected with the help of Coccinelle.

> 

> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

> Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>

> ---

>  net/smc/smc.h | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/net/smc/smc.h b/net/smc/smc.h

> index bfbe20234105..9518986c97b1 100644

> --- a/net/smc/smc.h

> +++ b/net/smc/smc.h

> @@ -252,12 +252,12 @@ static inline int smc_uncompress_bufsize(u8 compressed)

>  static inline bool using_ipsec(struct smc_sock *smc)

>  {

>  	return (smc->clcsock->sk->sk_policy[0] ||

> -		smc->clcsock->sk->sk_policy[1]) ? 1 : 0;

> +		smc->clcsock->sk->sk_policy[1]) ? true : false;

>  }


Hello Ursula,

If you ever have to touch this code again, please follow the style of other kernel
code and leave out the "? true : false" part and also the parentheses. Both are
superfluous.

Thanks,

Bart.
diff mbox series

Patch

diff --git a/net/smc/smc.h b/net/smc/smc.h
index bfbe20234105..9518986c97b1 100644
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -252,12 +252,12 @@  static inline int smc_uncompress_bufsize(u8 compressed)
 static inline bool using_ipsec(struct smc_sock *smc)
 {
 	return (smc->clcsock->sk->sk_policy[0] ||
-		smc->clcsock->sk->sk_policy[1]) ? 1 : 0;
+		smc->clcsock->sk->sk_policy[1]) ? true : false;
 }
 #else
 static inline bool using_ipsec(struct smc_sock *smc)
 {
-	return 0;
+	return false;
 }
 #endif