From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Ben Romer <benjamin.romer@unisys.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
devel@driverdev.osuosl.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
sparmaintainer@unisys.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: unisys: use common return path
Date: Wed, 2 Dec 2015 10:31:18 +0530 [thread overview]
Message-ID: <20151202050118.GB3692@sudip-pc> (raw)
In-Reply-To: <565DC7D0.3000307@unisys.com>
On Tue, Dec 01, 2015 at 11:16:16AM -0500, Ben Romer wrote:
> On 12/01/2015 10:57 AM, Dan Carpenter wrote:
> >What I meant was that I'm generally opposed to "common exit paths".
> >Mixing all the exit paths together often makes the code more complicated
> >and leads to errors. That makes sense from a common sense perspective
> >that doing many things is more difficult than doing one thing? Anyway
> >it's easy enough to verify empirically that this style is bug prone.
> >
> >On the other hand there are times where all exit paths need to unlock or
> >to free a variable and in those cases using a common exit path makes
> >sense. Just don't standardize on "Every function should only have a
> >single return".
> >
>
> That works for me. Mainly my issue with it is that I've spent a lot
> of time trying to eliminate "goto Away" code from the drivers, so
> I'd rather not put any back if possible.
But what is wrong with goto?
Quoting from CodingStyle:
"The goto statement comes in handy when a function exits from multiple
locations and some common work such as cleanup has to be done. If there
is no cleanup needed then just return directly."
I am absolutely fine if you don't want it to be applied but just for
knowing -
It has multiple exits.
In this case spin_unlock_irqrestore() is the common work.
regards
sudip
next prev parent reply other threads:[~2015-12-02 5:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-01 6:15 [PATCH] staging: unisys: use common return path Sudip Mukherjee
2015-12-01 8:00 ` Dan Carpenter
2015-12-01 8:06 ` Dan Carpenter
2015-12-01 9:57 ` Sudip Mukherjee
2015-12-01 16:05 ` Dan Carpenter
2015-12-02 4:49 ` Sudip Mukherjee
2015-12-01 14:54 ` Ben Romer
2015-12-01 15:57 ` Dan Carpenter
2015-12-01 16:16 ` Ben Romer
2015-12-02 5:01 ` Sudip Mukherjee [this message]
2015-12-02 5:02 ` Sudip Mukherjee
2015-12-02 6:20 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151202050118.GB3692@sudip-pc \
--to=sudipm.mukherjee@gmail.com \
--cc=benjamin.romer@unisys.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sparmaintainer@unisys.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox