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

Alexey Kardashevskiy aik at ozlabs.ru
Tue Feb 25 12:38:16 AEDT 2020



On 24/02/2020 21:04, Segher Boessenkool wrote:
> 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).

oh cool, I did not think gcc is that smart.



-- 
Alexey


More information about the Linuxppc-dev mailing list