
From: Simon Glass <sjg@chromium.org> Remove a few more lines from fit_image_load() by dealing with this small detail in check_allowed(). Signed-off-by: Simon Glass <sjg@chromium.org> --- (no changes since v1) boot/image-fit.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/boot/image-fit.c b/boot/image-fit.c index 244397b26c5..26d29715683 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -2163,17 +2163,19 @@ static int select_image(const void *fit, struct bootm_headers *images, * * @fit: FIT to check * @noffset: Node offset of the image being loaded + * @images: Boot images structure * @image_type: Type of the image * @arch: Expected architecture for the image * @bootstage_id: ID of starting bootstage to use for progress updates * Return: 0 if OK, -EIO if not */ static int check_allowed(const void *fit, int noffset, + struct bootm_headers *images, enum image_type_t image_type, enum image_arch_t arch, int bootstage_id) { bool type_ok, os_ok; - uint8_t os; + uint8_t os, os_arch; bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ARCH); if (!tools_build() && IS_ENABLED(CONFIG_SANDBOX)) { @@ -2219,6 +2221,9 @@ static int check_allowed(const void *fit, int noffset, bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL_OK); + fit_image_get_arch(fit, noffset, &os_arch); + images_set_arch(images, os_arch); + return 0; } @@ -2442,7 +2447,6 @@ int fit_image_load(struct bootm_headers *images, ulong addr, const void *fit; void *buf; ulong load, data, len; - uint8_t os_arch; const char *prop_name; int ret; @@ -2459,13 +2463,11 @@ int fit_image_load(struct bootm_headers *images, ulong addr, if (noffset < 0) return noffset; - ret = check_allowed(fit, noffset, image_type, arch, bootstage_id); + ret = check_allowed(fit, noffset, images, image_type, arch, + bootstage_id); if (ret) return ret; - fit_image_get_arch(fit, noffset, &os_arch); - images_set_arch(images, os_arch); - ret = obtain_data(fit, noffset, prop_name, bootstage_id, &buf, &len); if (ret) return ret; -- 2.43.0