소스 검색

Staging: lustre: Unnecessory else and braces are removed

This patch fixes following checkpatch.pl warning using coccinelle:

WARNING: else is not generally useful after a break or return

Semantic patch used for this is as follows:

@rule1@
expression e1;
@@

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

@rule2@
expression e2;
statement s1;
@@

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

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vaishali Thakkar 11 년 전
부모
커밋
2d02b0b81c
1개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 5
      drivers/staging/lustre/lustre/obdclass/capa.c

+ 4 - 5
drivers/staging/lustre/lustre/obdclass/capa.c

@@ -213,12 +213,11 @@ struct obd_capa *capa_add(struct hlist_head *hash, struct lustre_capa *capa)
 			capa_delete_lru(list);
 		spin_unlock(&capa_lock);
 		return ocapa;
-	} else {
-		capa_get(old);
-		spin_unlock(&capa_lock);
-		capa_put(ocapa);
-		return old;
 	}
+	capa_get(old);
+	spin_unlock(&capa_lock);
+	capa_put(ocapa);
+	return old;
 }
 EXPORT_SYMBOL(capa_add);