Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281449
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] staging: unisys: use common return path |
| Date | 2015-12-02 06:10 +0100 |
| Message-ID | <qB7PY-2KY-7@gated-at.bofh.it> (permalink) |
| References | <qAMs9-5Ts-11@gated-at.bofh.it> <qAOaB-726-3@gated-at.bofh.it> <qAUzo-2vH-15@gated-at.bofh.it> <qAVvs-38i-15@gated-at.bofh.it> <qAVOO-3v2-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] staging: unisys: use common return path Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-01 07:20 +0100
Re: [PATCH] staging: unisys: use common return path Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-01 09:10 +0100
Re: [PATCH] staging: unisys: use common return path Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-01 11:00 +0100
Re: [PATCH] staging: unisys: use common return path Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-01 17:10 +0100
Re: [PATCH] staging: unisys: use common return path Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-02 06:00 +0100
Re: [PATCH] staging: unisys: use common return path Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-01 09:10 +0100
Re: [PATCH] staging: unisys: use common return path Ben Romer <benjamin.romer@unisys.com> - 2015-12-01 16:00 +0100
Re: [PATCH] staging: unisys: use common return path Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-01 17:00 +0100
Re: [PATCH] staging: unisys: use common return path Ben Romer <benjamin.romer@unisys.com> - 2015-12-01 17:20 +0100
Re: [PATCH] staging: unisys: use common return path Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-02 06:10 +0100
Re: [PATCH] staging: unisys: use common return path Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-02 06:10 +0100
Re: [PATCH] staging: unisys: use common return path Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-02 07:30 +0100
csiph-web