[PATCH v4 6/8] image: Do not #if guard board_fit_image_post_process() prototype

Alexandru Gagniuc mr.nuke.me at gmail.com
Wed Jan 20 17:46:54 CET 2021

There's no point in guarding function prototypes with #ifdefs. If a
function is not defined, the linker will notice. Having the prototype
does not affect code size.

What the #if guard takes away is the ability to use IS_ENABLED:


When the prototype is guarded, the above form cannot be used. This
leads to the proliferation of #ifdefs, and unreadable code. The
opportunity cost of the #if guard outweighs any benefits. Remove it.

Since the original version of this patch, an empty definition was
added by commit f14e6eec6c7f ("image: cleanup pre-processor usage").
The empty definition can cause silent failures, when an implementation
of board_fit_image_post_process() is expected because the linker will
not catch the missing function. Thus this patch removes this empty
inline declaration.

Fixes: f14e6eec6c7f ("image: cleanup pre-processor usage")
Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
 include/image.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/include/image.h b/include/image.h
index 856bc3e1b2..5cd143856a 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1537,8 +1537,6 @@ bool android_image_print_dtb_contents(ulong hdr_addr);
 int board_fit_config_name_match(const char *name);
  * board_fit_image_post_process() - Do any post-process on FIT binary data
@@ -1553,11 +1551,6 @@ int board_fit_config_name_match(const char *name);
  * @return no return value (failure should be handled internally)
 void board_fit_image_post_process(void **p_image, size_t *p_size);
-static inline void board_fit_image_post_process(void **p_image, size_t *p_size)
 #define FDT_ERROR	((ulong)(-1))

More information about the U-Boot mailing list