[PATCH v2 42/50] image: Drop #ifdefs for fit_print_contents()

Alex G. mr.nuke.me at gmail.com
Fri May 14 23:46:11 CEST 2021



On 5/6/21 9:24 AM, Simon Glass wrote:
> Use a simple return to drop the unwanted code.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>

Reviewed-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>

> ---
> 
> (no changes since v1)
> 
>   common/image-fit.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 3ee306143b3..f8aa61fc99d 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -165,7 +165,6 @@ int fit_get_subimage_count(const void *fit, int images_noffset)
>   	return count;
>   }
>   
> -#if CONFIG_IS_ENABLED(FIT_PRINT)
>   /**
>    * fit_image_print_data() - prints out the hash node details
>    * @fit: pointer to the FIT format image header
> @@ -375,6 +374,9 @@ void fit_print_contents(const void *fit)
>   	const char *p;
>   	time_t timestamp;
>   
> +	if (!CONFIG_IS_ENABLED(FIT_PRINT))
> +		return;
> +
>   	/* Indent string is defined in header image.h */
>   	p = IMAGE_INDENT_STRING;
>   
> @@ -477,6 +479,9 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)
>   	int ndepth;
>   	int ret;
>   
> +	if (!CONFIG_IS_ENABLED(FIT_PRINT))
> +		return;
> +
>   	/* Mandatory properties */
>   	ret = fit_get_desc(fit, image_noffset, &desc);
>   	printf("%s  Description:  ", p);
> @@ -570,10 +575,6 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)
>   		}
>   	}
>   }
> -#else
> -void fit_print_contents(const void *fit) { }
> -void fit_image_print(const void *fit, int image_noffset, const char *p) { }
> -#endif /* CONFIG_IS_ENABLED(FIT_PRINT) */
>   
>   /**
>    * fit_get_desc - get node description property
> 


More information about the U-Boot mailing list