Staging: lustre: Return statement is moved left after removing else

Author: Vaishali Thakkar <vthakkar1994@gmail.com>

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 
Acked-by: Julia Lawall 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
index 0067e06..c1e8aa4 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
@@ -442,8 +442,7 @@ int ptlrpc_reply(struct ptlrpc_request *req)
 {
 	if (req->rq_no_reply)
 		return 0;
-	else
-		return ptlrpc_send_reply(req, 0);
+	return ptlrpc_send_reply(req, 0);
 }
 EXPORT_SYMBOL(ptlrpc_reply);
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.