[U-Boot] [PATCH 01/13] efi_loader: efi_bootmgr: do not make hidden assignments

Alexander Graf agraf at suse.de
Wed Nov 8 15:27:39 UTC 2017


On 11/01/2017 09:31 AM, Heinrich Schuchardt wrote:
> Assignments should not be made in the middle of nowhere.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>   lib/efi_loader/efi_bootmgr.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
> index 857d88a879..d8d0e495f7 100644
> --- a/lib/efi_loader/efi_bootmgr.c
> +++ b/lib/efi_loader/efi_bootmgr.c
> @@ -120,10 +120,10 @@ static void *try_load_entry(uint16_t n, struct efi_device_path **device_path,
>   
>   	if (lo.attributes & LOAD_OPTION_ACTIVE) {
>   		efi_status_t ret;
> -		u16 *str = NULL;
> +		u16 *str = efi_dp_str(lo.file_path);
>   
>   		debug("%s: trying to load \"%ls\" from: %ls\n", __func__,
> -		      lo.label, (str = efi_dp_str(lo.file_path)));
> +		      lo.label, str);
>   		efi_free_pool(str);

I believe the idea was to only go through efi_dp_str() if debugging is 
enabled.

Maybe write it as

#ifdef DEBUG
u16 *str = efi_dp_str(...);
#else
u16 *str = NULL,
#endif

instead?


Alex



More information about the U-Boot mailing list