]> git.dujemihanovic.xyz Git - u-boot.git/commit
image: Do not #if guard board_fit_image_post_process() prototype
authorAlexandru Gagniuc <mr.nuke.me@gmail.com>
Wed, 20 Jan 2021 16:46:54 +0000 (10:46 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 18 Feb 2021 00:46:43 +0000 (19:46 -0500)
commit9e304239785dce3100303bf3dc211cf544247da0
tree734d45a86f1cae73f9a516d271c1b8c627ea8943
parent9e9aa0b473a3217796e7d76a51004af2f42161fd
image: Do not #if guard board_fit_image_post_process() prototype

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:

if (CONFIG_IS ENABLED(FIT_IMAGE_POST_PROCESS))
board_fit_image_post_process(...)

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@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/image.h