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

Alexey Kardashevskiy aik at ozlabs.ru
Mon Feb 24 13:32:28 AEDT 2020



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.
> 
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
>  arch/powerpc/platforms/powernv/setup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
> index 11fdae8..a8fe630 100644
> --- a/arch/powerpc/platforms/powernv/setup.c
> +++ b/arch/powerpc/platforms/powernv/setup.c
> @@ -229,7 +229,7 @@ static void  __noreturn pnv_restart(char *cmd)
>  	pnv_prepare_going_down();
>  
>  	do {
> -		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) ;)


>  			rc = opal_cec_reboot();
>  		else if (strcmp(cmd, "full") == 0)
>  			rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL);
> 

-- 
Alexey


More information about the Linuxppc-dev mailing list