Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1587246
| From | Ricardo Neri <ricardo.neri-calderon@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP |
| Date | 2017-02-24 03:50 +0100 |
| Message-ID | <tee7f-1We-1@gated-at.bofh.it> (permalink) |
| References | <tdVei-5Qz-5@gated-at.bofh.it> <tdVnY-5XM-7@gated-at.bofh.it> <tdW0G-6s1-9@gated-at.bofh.it> <te9TY-7sz-23@gated-at.bofh.it> <tedXz-1SH-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 2017-02-23 at 18:33 -0800, Joe Perches wrote:
> On Thu, 2017-02-23 at 14:17 -0800, Ricardo Neri wrote:
> > On Thu, 2017-02-23 at 08:24 +0100, Peter Zijlstra wrote:
> > > On Wed, Feb 22, 2017 at 10:36:50PM -0800, Ricardo Neri wrote:
> > > > + /*
> > > > + * A negative offset generally means a error, except
> > > > + * -EDOM, which means that the contents of the register
> > > > + * should not be used as index.
> > > > + */
> > > > if (indx_offset < 0)
> > > > - goto out_err;
> > > > + if (indx_offset == -EDOM)
> > > > + indx = 0;
> > > > + else
> > > > + goto out_err;
> > > > + else
> > > > + indx = regs_get_register(regs, indx_offset);
> > >
> > > Kernel coding style requires more brackets than are strictly required by
> > > C, any block longer than 1 line needs then. Also, if one leg of a
> > > conditional needs them, then they should be on both legs.
> > >
> > > Your code has many such instances, please change them all.
> >
> > Will do. Sorry for the noise. These instances escaped the checkpatch
> > script.
>
> Also, this code would read better with the inner test
> reversed or done first
>
> if (indx_offset < 0) {
> if (indx_offset != -EDOM)
> goto out_err;
> indx = 0;
> } else {
> indx = regs_get_register(etc...)
> }
>
> or
> if (indx_offset == -EDOM)
> indx = 0;
> else if (indx_offset < 0)
> goto err;
> else
> indx = regs_get_register(etc...)
>
> The compiler should generate the same code in any
> case, but either could improve reader understanding.
I agree! I will change it with your clever solution.
Thanks and BR,
Ricardo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-02-23 07:50 +0100
Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Peter Zijlstra <peterz@infradead.org> - 2017-02-23 08:30 +0100
Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Paul Crawford <psc@sat.dundee.ac.uk> - 2017-02-23 11:00 +0100
Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-02-23 23:20 +0100
Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Joe Perches <joe@perches.com> - 2017-02-24 03:40 +0100
Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-02-24 03:50 +0100
Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Adan Hawthorn <adanhawthorn@gmail.com> - 2017-02-24 16:10 +0100
Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-02-24 20:10 +0100
csiph-web