Skip to contentSkip to conversation

staging: lustre: Remove unnecessary return capture

PATCH Superseded Rehas Sachdeva 2 participants 2 messages Sep 15, 2016 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lustre: Remove unnecessary return capture

Instead of storing the return value of a function call into a variable and then returning it, we can club the two into a single return - call form of statement. This change was made using the following semantic patch by Coccinelle:

@@
local idexpression ret;
expression e;
@@

-ret =
+return

     e;

-return ret;

---
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_request.c +2 -3
index 5bf95f9..cf94926 100644
@@ -2488,9 +2488,8 @@ static int mdc_set_info_async(const struct lu_env *env,
 		}
 		spin_unlock(&imp->imp_lock);
 
-		rc = do_set_info_async(imp, MDS_SET_INFO, LUSTRE_MDS_VERSION,
-				       keylen, key, vallen, val, set);
-		return rc;
+		return do_set_info_async(imp, MDS_SET_INFO, LUSTRE_MDS_VERSION,
+					 keylen, key, vallen, val, set);
 	}
 	if (KEY_IS(KEY_SPTLRPC_CONF)) {
 		sptlrpc_conf_client_adapt(exp->exp_obd);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 10 lines · Rehas Sachdeva

Instead of storing the return value of a function call into a variable and then returning it, we can club the two into a single return - call form of statement. This change was made using the following semantic patch by Coccinelle:

@@
local idexpression ret;
expression e;
@@

Review

Quoted 4 lines
(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;

"return - call form of statement" is a bit verbose. "return" would be fine. Looks fine otherwise.

julia

Quoted 32 lines
---
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_request.c +2 -4
index 5bf95f9..cf94926 100644
@@ -2488,9 +2488,8 @@ static int mdc_set_info_async(const struct lu_env *env,
 		}
 		spin_unlock(&imp->imp_lock);
 
-		rc = do_set_info_async(imp, MDS_SET_INFO, LUSTRE_MDS_VERSION,
-				       keylen, key, vallen, val, set);
-		return rc;
+		return do_set_info_async(imp, MDS_SET_INFO, LUSTRE_MDS_VERSION,
+					 keylen, key, vallen, val, set);
 	}
 	if (KEY_IS(KEY_SPTLRPC_CONF)) {
 		sptlrpc_conf_client_adapt(exp->exp_obd);
--

2.7.4

--
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/20160915181631.GA32498%40toblerone.
For more options, visit https://groups.google.com/d/optout.