[PATCH 2/3] qfw: return failure when no kernel could be loaded

Andre Przywara andre.przywara at arm.com
Mon Oct 10 19:01:21 CEST 2022


When we try to load a kernel via the QEMU firmware device, we currently
"return -1;" if no kernel was specified on the QEMU command line. This
leads to the usage output, which is confusing (since nothing on the
command line was really wrong), but also somewhat hides the actual error
message.

Return CMD_RET_FAILURE (1), as it's a proper error, and make the message
more clear that this is not only a "warning".

This helps to call this command in boot scripts, and to gracefully
continue if this doesn't work.

Signed-off-by: Andre Przywara <andre.przywara at arm.com>
---
 cmd/qfw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmd/qfw.c b/cmd/qfw.c
index c61001b771d..95ddc4b79ec 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -26,8 +26,8 @@ static int qemu_fwcfg_cmd_setup_kernel(void *load_addr, void *initrd_addr)
 	qfw_read_entry(qfw_dev, FW_CFG_KERNEL_SIZE, 4, &kernel_size);
 
 	if (kernel_size == 0) {
-		printf("warning: no kernel available\n");
-		return -1;
+		printf("fatal: no kernel available\n");
+		return CMD_RET_FAILURE;
 	}
 
 	data_addr = load_addr;
-- 
2.25.1



More information about the U-Boot mailing list