Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1314257
| From | Kalle Valo <kvalo@codeaurora.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] net-libertas: Better exception handling in if_spi_host_to_card_worker() |
| Date | 2016-01-21 16:10 +0100 |
| Message-ID | <qTp23-6YC-35@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <qMfAu-7JT-15@gated-at.bofh.it> <qMh9g-ms-11@gated-at.bofh.it> <qMpzQ-5Go-1@gated-at.bofh.it> <qMpJv-5Jv-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Julia Lawall <julia.lawall@lip6.fr> writes: > On Sat, 2 Jan 2016, SF Markus Elfring wrote: > >> >> Move the jump label directly before the desired log statement >> >> so that the variable "err" will not be checked once more >> >> after it was determined that a function call failed. >> >> Use the identifier "report_failure" instead of the label "err". >> > >> > Why? >> >> I suggest to reconsider the places with which such a jump label >> is connected. >> >> >> > The code was smart enough >> >> Which action should really be performed after a failure was detected >> and handled a bit already? >> >> * Another condition check >> >> * Just additional error logging >> >> >> > and you're making it uglier that it needs to be. >> >> I assume that a software development taste can evolve, can't it? > > So far, you have gotten several down votes for this kind of change, and no > enthusiasm. > > Admittedly, this is a trivial case, because there are no local variables, > but do you actually know the semantics in C of a jump into a block? And > if you do know, do you think that this semantics is common knowledge? And > do you really think that introducing poorly understandable code is really > worth saving an if test of a single variable on a non-critical path? > > Most of the kernel code is not performance critical at the level of a > single if test. So the goal should be for the code to be easy to > understand and robust to change. The code that is performance critical, > you should probably not touch, ever. The people who wrote it knew what > was important and what was not. Very well said! Only optimise something you can measure. I'm dropping this patch. -- Kalle Valo
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH] net-libertas: Better exception handling in if_spi_host_to_card_worker() Kalle Valo <kvalo@codeaurora.org> - 2016-01-21 16:10 +0100
csiph-web