
From: Simon Glass <sjg@chromium.org> This field is not present in host builds. Create an inline function to handle this complexity, so we can drop the #ifdef in the C file. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/image-fit.c | 10 ++-------- include/image.h | 7 +++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/boot/image-fit.c b/boot/image-fit.c index 740fbee8897..754b309b91b 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -2176,7 +2176,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr, size_t size; int type_ok, os_ok; ulong load, load_end, data, len; - uint8_t os, comp; + uint8_t os, comp, os_arch; const char *prop_name; fit = map_sysmem(addr, 0); @@ -2201,14 +2201,8 @@ int fit_image_load(struct bootm_headers *images, ulong addr, } } -#ifndef USE_HOSTCC - { - uint8_t os_arch; - fit_image_get_arch(fit, noffset, &os_arch); - images->os.arch = os_arch; - } -#endif + images_set_arch(images, os_arch); bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL); type_ok = fit_image_check_type(fit, noffset, image_type) || diff --git a/include/image.h b/include/image.h index 283cc9c5741..3a6afb5d954 100644 --- a/include/image.h +++ b/include/image.h @@ -459,6 +459,13 @@ struct bootm_headers { extern struct bootm_headers images; +static inline void images_set_arch(struct bootm_headers *images, int os_arch) +{ +#ifndef USE_HOSTCC + images->os.arch = os_arch; +#endif +} + /* * Some systems (for example LWMON) have very short watchdog periods; * we must make sure to split long operations like memmove() or -- 2.43.0