Thread (8 messages) 8 messages, 5 authors, 2020-03-06

Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default

From: Segher Boessenkool <hidden>
Date: 2020-02-24 10:07:10

On Mon, Feb 24, 2020 at 01:32:28PM +1100, Alexey Kardashevskiy wrote:
On 17/02/2020 13:48, Oliver O'Halloran wrote:
quoted
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.
quoted
-		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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help