[PATCH] qfw: Don't fail if setup data size is 0

Pierre-Clément Tosi ptosi at google.com
Wed May 25 15:38:55 CEST 2022


Skip missing setup data (which is valid) rather than failing with an
error.

Cc: Bin Meng <bmeng.cn at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
Reported-by: Andrew Walbran <qwandor at google.com>
Signed-off-by: Pierre-Clément Tosi <ptosi at google.com>
---
 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.36.1.124.g0e6072fb45-goog



More information about the U-Boot mailing list