]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
qfw: Don't fail if setup data size is 0
authorPierre-Clément Tosi <ptosi@google.com>
Wed, 25 May 2022 13:38:55 +0000 (14:38 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 6 Jun 2022 22:01:21 +0000 (18:01 -0400)
Skip missing setup data (which is valid) rather than failing with an
error.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reported-by: Andrew Walbran <qwandor@google.com>
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
cmd/qfw.c

index d58615040c64dc110fd5aac1dcfe46846668d136..ccbc967ca9f698b37a98c8557ba09c2199d2296f 100644 (file)
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -25,15 +25,17 @@ static int qemu_fwcfg_cmd_setup_kernel(void *load_addr, void *initrd_addr)
        qfw_read_entry(qfw_dev, FW_CFG_SETUP_SIZE, 4, &setup_size);
        qfw_read_entry(qfw_dev, FW_CFG_KERNEL_SIZE, 4, &kernel_size);
 
-       if (setup_size == 0 || kernel_size == 0) {
+       if (kernel_size == 0) {
                printf("warning: no kernel available\n");
                return -1;
        }
 
        data_addr = load_addr;
-       qfw_read_entry(qfw_dev, FW_CFG_SETUP_DATA,
-                      le32_to_cpu(setup_size), data_addr);
-       data_addr += le32_to_cpu(setup_size);
+       if (setup_size != 0) {
+               qfw_read_entry(qfw_dev, FW_CFG_SETUP_DATA,
+                              le32_to_cpu(setup_size), data_addr);
+               data_addr += le32_to_cpu(setup_size);
+       }
 
        qfw_read_entry(qfw_dev, FW_CFG_KERNEL_DATA,
                       le32_to_cpu(kernel_size), data_addr);