On Sun, Dec 03, 2023 at 05:31:31PM -0700, Simon Glass wrote:

> Allow the default command line to be used when booting the OS. This is
> needed by fastboot.
> 
> Signed-off-by: Simon Glass <s...@chromium.org>
> ---
> 
>  boot/bootm.c    | 10 ++++++----
>  include/bootm.h |  2 +-
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/boot/bootm.c b/boot/bootm.c
> index f630b8c1a9c3..4a5da2a3bebf 100644
> --- a/boot/bootm.c
> +++ b/boot/bootm.c
> @@ -1187,10 +1187,12 @@ int bootm_boot_start(ulong addr, const char *cmdline)
>  
>       snprintf(addr_str, sizeof(addr_str), "%lx", addr);
>  
> -     ret = env_set("bootargs", cmdline);
> -     if (ret) {
> -             printf("Failed to set cmdline\n");
> -             return ret;
> +     if (cmdline) {
> +             ret = env_set("bootargs", cmdline);
> +             if (ret) {
> +                     printf("Failed to set cmdline\n");
> +                     return ret;
> +             }
>       }
>       memset(&bmi, '\0', sizeof(bmi));
>       bmi.addr_fit = addr_str;

env_set handles NULL today. If there's some problem with fastboot with
CMDLINE=n without this patch I worry there's a functional problem being
obscured here. Or it's not a problem at this point in the code to set
bootargs to empty and we need to allow for that in general.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to