[U-Boot] [PATCH v2 1/1] vsprintf.c: add EFI device path printing

Wolfgang Denk wd at denx.de
Sun Nov 26 13:17:01 UTC 2017


Dear Heinrich,

In message <20171123215901.8992-1-xypron.glpk at gmx.de> you wrote:
>
> +#ifdef CONFIG_EFI_LOADER
> +static char *device_path_string(char *buf, char *end, void *dp, int field_width,
> +				int precision, int flags)
> +{
> +	u16 *str = efi_dp_str((struct efi_device_path *)dp);
> +
> +	/* Do not silently ignore out of memory situation */
> +	if (!str && dp)
> +		panic("efi_dp_str: out of memory");
> +
> +	buf = string16(buf, end, str, field_width, precision, flags);
> +	efi_free_pool(str);
> +	return buf;
> +}

I think this would be much clearer if you wrote:

	u16 *str;

	if (dp == NULL)
		return "<NULL>";

	str = efi_dp_str((struct efi_device_path *)dp);

	if (str == NULL)
		panic("device_path_string(): out of memory");

	buf = string16(buf, end, str, field_width, precision, flags);
	efi_free_pool(str); 
	return buf;

Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
grep me no patterns and I'll tell you no lines.


More information about the U-Boot mailing list