staging: lusture: ptlrpc: Remove useless return variables
PATCH 8/8 staging: lusture: ptlrpc: Remove useless return variables
This patch removes unnecessary return variables and compresses the return logic.
The coccinelle script that finds and fixes this issue is:
@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +1 -4
@@ -421,10 +421,7 @@ void ptlrpc_request_cache_fini(void)struct ptlrpc_request *ptlrpc_request_cache_alloc (gfp_t flags) { -struct ptlrpc_request *req; - - req =kmem_cache_alloc (request_cache, flags | __GFP_ZERO); -return req; +return kmem_cache_alloc (request_cache, flags | __GFP_ZERO); }void ptlrpc_request_cache_free (struct ptlrpc_request *req)
--
2.1.4
Quoted 25 lines · Bhaktipriya Shridhar
This patch removes unnecessary return variables and compresses the return logic.
The coccinelle script that finds and fixes this issue is:
@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)Signed-off-by Bhaktipriya Shridhar <[email protected]>--- drivers/staging/lustre/lustre/ptlrpc/client.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/lustre/lustre/ptlrpc/client.c +0
-0
drivers/staging/lustre/lustre/ptlrpc/client.c void ptlrpc_request_cache_fini(void) · line 424
Quoted 8 lines
drivers/staging/lustre/lustre/ptlrpc/client.c +1
-4@@ -421,10 +421,7 @@ void ptlrpc_request_cache_fini(void)struct ptlrpc_request *ptlrpc_request_cache_alloc (gfp_t flags) { -struct ptlrpc_request *req; - - req =kmem_cache_alloc (request_cache, flags | __GFP_ZERO); -return req; +return kmem_cache_alloc (request_cache, flags | __GFP_ZERO);
Not related to this change, but this call would be better as using kmem_cache_zalloc, whih takes care of the | __GFP_ZERO. One could also consider whether this function and the next one could just be unfolded and dropped entirely.
julia
Quoted 13 lines
drivers/staging/lustre/lustre/ptlrpc/client.c +0
-1}void ptlrpc_request_cache_free (struct ptlrpc_request *req) --2.1.4
Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160224202858.GA23036%40Karyakshetra. For more options, visit https://groups.google.com/d/optout.