From 5f1ce1d4ca4decef688fe0dd71b11927d6a18845 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 26 Jan 2018 06:30:30 +0100 Subject: vsprintf.c: correct printing of a NULL device path When printing '%pD' with a value of NULL we want to output ''. But this requires copying to buf. Leave this to string16. A unit test is supplied which relies on EFI support in the sandbox. The development for EFI support in the sandbox is currently in branch u-boot-dm/efi-working. The branch lacks commit 6ea8b580f06b ("efi_loader: correct DeviceNodeToText for media types"). Ater rebasing the aforementioned branch on U-Boot v2018.01 and adding 256060e4257a2 and this patch the test is executed successfully. Fixes: 256060e4257a2 (vsprintf.c: add EFI device path printing) Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- test/print_ut.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/print_ut.c') diff --git a/test/print_ut.c b/test/print_ut.c index 1aa68be7a9..d8e9da8fa8 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -44,6 +44,10 @@ static void efi_ut_print(void) snprintf(str, sizeof(str), "_%pD_", buf); assert(!strcmp("_/SD(3)_", str)); + + /* NULL device path */ + snprintf(str, sizeof(str), "_%pD_", NULL); + assert(!strcmp("__", str)); #endif } -- cgit v1.2.1