[PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default
Segher Boessenkool
segher at kernel.crashing.org
Mon Feb 24 21:04:42 AEDT 2020
On Mon, Feb 24, 2020 at 01:32:28PM +1100, Alexey Kardashevskiy wrote:
> On 17/02/2020 13:48, Oliver O'Halloran wrote:
> > Treat an empty reboot cmd string the same as a NULL string. This squashes a
> > spurious unsupported reboot message that sometimes gets out when using
> > xmon.
> > - if (!cmd)
> > + if (!cmd || !strlen(cmd))
>
> nit: this does not matter here in practice but
>
> if (!cmd || cmd[0] == '\0')
>
> is faster (you do not care about the length anyway) and safer (@cmd can
> potentially be endless) ;)
No it isn't, this compiles to identical machine code. (I tested with
GCC 9, and going back until 4.6 -- the generated code becomes
progressively worse (unrelated to this code, fwiw), but identical for
both cases all the time).
Segher
More information about the Linuxppc-dev
mailing list