{
struct efi_disk_obj *diskobj;
struct efi_object *handle;
- const efi_guid_t *guid = NULL;
+ const efi_guid_t *esp_guid = NULL;
efi_status_t ret;
/* Don't add empty devices */
efi_free_pool(node);
diskobj->media.last_block = part_info->size - 1;
if (part_info->bootable & PART_EFI_SYSTEM_PARTITION)
- guid = &efi_system_partition_guid;
+ esp_guid = &efi_system_partition_guid;
} else {
diskobj->dp = efi_dp_from_part(desc, part);
diskobj->media.last_block = desc->lba - 1;
* in this case.
*/
handle = &diskobj->header;
- ret = efi_install_multiple_protocol_interfaces(&handle,
- &efi_guid_device_path,
- diskobj->dp,
- &efi_block_io_guid,
- &diskobj->ops, guid,
- NULL, NULL);
+ ret = efi_install_multiple_protocol_interfaces(
+ &handle,
+ &efi_guid_device_path, diskobj->dp,
+ &efi_block_io_guid, &diskobj->ops,
+ /*
+ * esp_guid must be last entry as it
+ * can be NULL. Its interface is NULL.
+ */
+ esp_guid, NULL,
+ NULL);
if (ret != EFI_SUCCESS)
goto error;