]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: efi_dp_from_lo() should skip VenMedia node
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 15 Oct 2021 00:59:15 +0000 (02:59 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 21 Oct 2021 01:46:04 +0000 (03:46 +0200)
The 'efidebug boot dump' command should not display the VenMedia() device
path node preceding the device path of the initial ram disk.

By letting efi_dp_from_lo() skip the VenMedia() device path node we can
simplify the coding.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_device_path.c
lib/efi_loader/efi_helper.c

index 58fff81a2d212c6e18bbb65b60b2e3e5223278d1..c04439d16d818d2c713a97b334692b62eb541367 100644 (file)
@@ -1233,7 +1233,7 @@ efi_device_path *efi_dp_from_lo(struct efi_load_option *lo,
 
                vendor = (struct efi_device_path_vendor *)fp;
                if (!guidcmp(&vendor->guid, guid))
-                       return efi_dp_dup(fp);
+                       return efi_dp_dup(efi_dp_next(fp));
        }
        log_debug("VenMedia(%pUl) not found in %ls\n", &guid, lo->label);
 
index 485384b7ee13b535308a82d608b6a1d8412947ec..b80a6e07dffd3b30658b4a43af8c73ba4a0e9c7f 100644 (file)
@@ -68,10 +68,8 @@ out:
  */
 struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid)
 {
-       struct efi_device_path *file_path = NULL;
-       struct efi_device_path *tmp = NULL;
        struct efi_load_option lo;
-       void *var_value = NULL;
+       void *var_value;
        efi_uintn_t size;
        efi_status_t ret;
        u16 var_name[16];
@@ -86,18 +84,11 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid)
 
        ret = efi_deserialize_load_option(&lo, var_value, &size);
        if (ret != EFI_SUCCESS)
-               goto out;
-
-       tmp = efi_dp_from_lo(&lo, &guid);
-       if (!tmp)
-               goto out;
+               goto err;
 
-       /* efi_dp_dup will just return NULL if efi_dp_next is NULL */
-       file_path = efi_dp_dup(efi_dp_next(tmp));
+       return efi_dp_from_lo(&lo, &guid);
 
-out:
-       efi_free_pool(tmp);
+err:
        free(var_value);
-
-       return file_path;
+       return NULL;
 }