svn commit: r281307 - head/sys/boot/efi/boot1

Bruce Evans brde at optusnet.com.au
Thu Apr 9 11:38:11 UTC 2015


On Thu, 9 Apr 2015, Andrew Turner wrote:

> Log:
>  Print error values with hex to make it easier to find the EFI error type.
>
> Modified:
>  head/sys/boot/efi/boot1/boot1.c
>
> Modified: head/sys/boot/efi/boot1/boot1.c
> ==============================================================================
> --- head/sys/boot/efi/boot1/boot1.c	Thu Apr  9 10:12:58 2015	(r281306)
> +++ head/sys/boot/efi/boot1/boot1.c	Thu Apr  9 10:15:47 2015	(r281307)
> @@ -330,18 +330,18 @@ load(const char *fname)
> 	status = systab->BootServices->LoadImage(TRUE, image, bootdevpath,
> 	    buffer, bufsize, &loaderhandle);
> 	if (EFI_ERROR(status))
> -		printf("LoadImage failed with error %d\n", status);
> +		printf("LoadImage failed with error %lx\n", status);

How would anyone guess that a number like "10" is in hex?

Hex numbers should usually be printed using "%#..." format.  If the boot
loader doesn't have that, then use an 0x prefix.

This shouldn't compile.  'status' cannot have type int and type unsigned
long at the same time.  clang warns even without -Wformat in CFLAGS.

Bruce


More information about the svn-src-all mailing list