]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: lustre: lustre: Remove unnecessary else after return
authorJanani Ravichandran <janani.rvchndrn@gmail.com>
Thu, 18 Feb 2016 21:52:45 +0000 (16:52 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Feb 2016 22:39:54 +0000 (14:39 -0800)
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 <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
drivers/staging/lustre/lustre/lov/lov_obd.c

index 19a513292ef27afdd565468f8eb644ab6003a2c6..ec758019bad6bb50f8f3540532a26741d8fb2d7e 100644 (file)
@@ -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);
 
index 809ea50fd08fef4de32685c7f36e3d731219ef73..91c2ae8f9d677ec1251eab26f610a3da6082a379 100644 (file)
@@ -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;
 }
 
 /*
index 2b7b8ceec553b5a1a20ae10a0820dbf5c1120237..90314c9707aed68dc0e2f0655bec481e2a01e5d1 100644 (file)
@@ -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,