From: Simon Glass <sjg@chromium.org>
Date: Sat, 18 Nov 2023 21:05:05 +0000 (-0700)
Subject: bootm: Reduce arguments to bootm_find_os()
X-Git-Tag: v2025.01-rc5-pxa1908~581^2~29^2~15
X-Git-Url: http://git.dujemihanovic.xyz/img/static//%22brlog.php?a=commitdiff_plain;h=3e3bd5bda7e505dde45585e6c7c1e07cddcb641e;p=u-boot.git

bootm: Reduce arguments to bootm_find_os()

This function only uses one argument so pass it in directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

diff --git a/boot/bootm.c b/boot/bootm.c
index 7aca2bf814..922989b9cf 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -304,8 +304,14 @@ static int bootm_pre_load(const char *addr_str)
 	return ret;
 }
 
-static int bootm_find_os(struct cmd_tbl *cmdtp, int flag, int argc,
-			 char *const argv[])
+/**
+ * bootm_find_os(): Find the OS to boot
+ *
+ * @cmd_name: Command name that started this boot, e.g. "bootm"
+ * @addr_fit: Address and/or FIT specifier (first arg of bootm command)
+ * Return: 0 on success, -ve on error
+ */
+static int bootm_find_os(const char *cmd_name, const char *addr_fit)
 {
 	const void *os_hdr;
 #ifdef CONFIG_ANDROID_BOOT_IMAGE
@@ -316,12 +322,11 @@ static int bootm_find_os(struct cmd_tbl *cmdtp, int flag, int argc,
 	int ret;
 
 	/* get kernel image header, start address and length */
-	ret = boot_get_kernel(argv[0], &images, &images.os.image_start,
+	ret = boot_get_kernel(addr_fit, &images, &images.os.image_start,
 			      &images.os.image_len, &os_hdr);
 	if (ret) {
 		if (ret == -EPROTOTYPE)
-			printf("Wrong Image Type for %s command\n",
-			       cmdtp->name);
+			printf("Wrong Image Type for %s command\n", cmd_name);
 
 		printf("ERROR %dE: can't get kernel image!\n", ret);
 		return 1;
@@ -987,7 +992,7 @@ int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
 		ret = bootm_pre_load(argv[0]);
 
 	if (!ret && (states & BOOTM_STATE_FINDOS))
-		ret = bootm_find_os(cmdtp, flag, argc, argv);
+		ret = bootm_find_os(cmdtp->name, argv[0]);
 
 	if (!ret && (states & BOOTM_STATE_FINDOTHER))
 		ret = bootm_find_other(cmdtp, flag, argc, argv);