[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1450203011.4142.4.camel@perches.com>
Date: Tue, 15 Dec 2015 10:10:11 -0800
From: Joe Perches <joe@...ches.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: SF Markus Elfring <elfring@...rs.sourceforge.net>,
Andreas Dilger <andreas.dilger@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Oleg Drokin <oleg.drokin@...el.com>,
lustre-devel@...ts.lustre.org, devel@...verdev.osuosl.org,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 1/7] staging: lustre: Delete unnecessary goto statements
in six functions
On Tue, 2015-12-15 at 20:48 +0300, Dan Carpenter wrote:
> On Tue, Dec 15, 2015 at 07:02:31AM -0800, Joe Perches wrote:
> > This is the original code:
> >
> > result = foo();
> > if (result)
> > goto label;
> >
> > result = bar();
> > if (result)
> > goto label;
> >
> > result = baz();
> > if (result)
> > goto label;
> >
> > label:
> > go on...
> >
>
> No. There is no test. The original code looks like:
>
> result = foo();
> if (result)
> goto out;
> result = baz();
> goto out;
> out:
> go on..
>
> regards,
> dan carpenter
Here is the original code:
---------------------
/* Copy hsm_progress struct */
req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS);
if (req_hpk == NULL) {
rc = -EPROTO;
goto out;
}
*req_hpk = *hpk;
req_hpk->hpk_errval = lustre_errno_hton(hpk->hpk_errval);
ptlrpc_request_set_replen(req);
rc = mdc_queue_wait(req);
goto out;
out:
ptlrpc_req_finished(req);
return rc;
}
---------------------
I think if the last goto out; is to be removed,
then it should be replaced by a blank line.
It separates the last operation block from the return.
cheers, Joe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists