From 24272ffd505be0597703032dbdd8ffdd7ef7a1a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pierre-Cl=C3=A9ment=20Tosi?= Date: Wed, 25 May 2022 14:38:55 +0100 Subject: [PATCH] qfw: Don't fail if setup data size is 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Skip missing setup data (which is valid) rather than failing with an error. Cc: Bin Meng Cc: Simon Glass Reported-by: Andrew Walbran Signed-off-by: Pierre-Clément Tosi --- cmd/qfw.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/qfw.c b/cmd/qfw.c index d58615040c..ccbc967ca9 100644 --- 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); -- 2.39.5