staging: lustre: fid,fld: expand the GOTO macro
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 30 Aug 2014 14:41:23 +0000 (16:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Aug 2014 19:24:59 +0000 (12:24 -0700)
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
identifier rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/fid/fid_request.c
drivers/staging/lustre/lustre/fld/fld_request.c

index 46c11ca..64b1d80 100644 (file)
@@ -113,7 +113,7 @@ static int seq_client_rpc(struct lu_client_seq *seq,
        if (seq->lcs_type == LUSTRE_SEQ_METADATA)
                mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
        if (rc)
-               GOTO(out_req, rc);
+               goto out_req;
 
        out = req_capsule_server_get(&req->rq_pill, &RMF_SEQ_RANGE);
        *output = *out;
@@ -121,13 +121,15 @@ static int seq_client_rpc(struct lu_client_seq *seq,
        if (!range_is_sane(output)) {
                CERROR("%s: Invalid range received from server: "
                       DRANGE"\n", seq->lcs_name, PRANGE(output));
-               GOTO(out_req, rc = -EINVAL);
+               rc = -EINVAL;
+               goto out_req;
        }
 
        if (range_is_exhausted(output)) {
                CERROR("%s: Range received from server is exhausted: "
                       DRANGE"]\n", seq->lcs_name, PRANGE(output));
-               GOTO(out_req, rc = -EINVAL);
+               rc = -EINVAL;
+               goto out_req;
        }
 
        CDEBUG_LIMIT(debug_mask, "%s: Allocated %s-sequence "DRANGE"]\n",
@@ -430,7 +432,7 @@ static int seq_client_proc_init(struct lu_client_seq *seq)
        if (rc) {
                CERROR("%s: Can't init sequence manager proc, rc %d\n",
                       seq->lcs_name, rc);
-               GOTO(out_cleanup, rc);
+               goto out_cleanup;
        }
 
        return 0;
@@ -508,8 +510,10 @@ int client_fid_init(struct obd_device *obd,
                return -ENOMEM;
 
        OBD_ALLOC(prefix, MAX_OBD_NAME + 5);
-       if (prefix == NULL)
-               GOTO(out_free_seq, rc = -ENOMEM);
+       if (prefix == NULL) {
+               rc = -ENOMEM;
+               goto out_free_seq;
+       }
 
        snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name);
 
@@ -517,7 +521,7 @@ int client_fid_init(struct obd_device *obd,
        rc = seq_client_init(cli->cl_seq, exp, type, prefix, NULL);
        OBD_FREE(prefix, MAX_OBD_NAME + 5);
        if (rc)
-               GOTO(out_free_seq, rc);
+               goto out_free_seq;
 
        return rc;
 out_free_seq:
index 4539a02..f63c669 100644 (file)
@@ -293,7 +293,7 @@ static int fld_client_proc_init(struct lu_client_fld *fld)
        if (rc) {
                CERROR("%s: Can't init FLD proc, rc %d\n",
                       fld->lcf_name, rc);
-               GOTO(out_cleanup, rc);
+               goto out_cleanup;
        }
 
        return 0;
@@ -363,12 +363,12 @@ int fld_client_init(struct lu_client_fld *fld,
        if (IS_ERR(fld->lcf_cache)) {
                rc = PTR_ERR(fld->lcf_cache);
                fld->lcf_cache = NULL;
-               GOTO(out, rc);
+               goto out;
        }
 
        rc = fld_client_proc_init(fld);
        if (rc)
-               GOTO(out, rc);
+               goto out;
 out:
        if (rc)
                fld_client_fini(fld);
@@ -441,11 +441,13 @@ int fld_client_rpc(struct obd_export *exp,
        if (fld_op != FLD_LOOKUP)
                mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
        if (rc)
-               GOTO(out_req, rc);
+               goto out_req;
 
        prange = req_capsule_server_get(&req->rq_pill, &RMF_FLD_MDFLD);
-       if (prange == NULL)
-               GOTO(out_req, rc = -EFAULT);
+       if (prange == NULL) {
+               rc = -EFAULT;
+               goto out_req;
+       }
        *range = *prange;
 out_req:
        ptlrpc_req_finished(req);