staging: lustre: lustre: Remove unnecessary else after return

Author: Janani Ravichandran <janani.rvchndrn@gmail.com>

Else is unnecessary when there is a return statement in the
corresponding if block. Coccinelle patch used:

@rule1@
expression e1;
@@

	if (e1) { ... return ...; }
-       else{
	        ...
-       }

@rule2@
expression e2;
statement s1;
@@

	if(e2) { ... return ...; }
-       else
		s1

Signed-off-by: Janani Ravichandran 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c    | 3 +--
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 5 ++---
 drivers/staging/lustre/lustre/lov/lov_obd.c                  | 3 ++-
 3 files changed, 5 insertions(+), 6 deletions(-)
 
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
index 19a5132..ec75801 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
@@ -233,8 +233,7 @@ int cfs_crypto_hash_speed(unsigned char hash_alg)
 {
 	if (hash_alg < CFS_HASH_ALG_MAX)
 		return cfs_crypto_hash_speeds[hash_alg];
-	else
-		return -1;
+	return -1;
 }
 EXPORT_SYMBOL(cfs_crypto_hash_speed);
 
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index 809ea50..91c2ae8 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -134,10 +134,9 @@ enum cfs_trace_buf_type cfs_trace_buf_idx_get(void)
 {
 	if (in_irq())
 		return CFS_TCD_TYPE_IRQ;
-	else if (in_softirq())
+	if (in_softirq())
 		return CFS_TCD_TYPE_SOFTIRQ;
-	else
-		return CFS_TCD_TYPE_PROC;
+	return CFS_TCD_TYPE_PROC;
 }
 
 /*
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 2b7b8ce..90314c9 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1550,7 +1550,8 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 					    len, karg, uarg);
 			if (err == -ENODATA && cmd == OBD_IOC_POLL_QUOTACHECK) {
 				return err;
-			} else if (err) {
+			}
+			if (err) {
 				if (lov->lov_tgts[i]->ltd_active) {
 					CDEBUG(err == -ENOTTY ?
 					       D_IOCTL : D_WARNING,
BtrLinux
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.