hibernate-resume: always clear HibernateLocation if system info matches

Follow-up for a628d933cc

HibernateInfo.from_efi is not actually useful. info.efi is only
set if the system identifier stored in EFI variable matches with
that of the running system, and thus the variable should be cleared
no matter whether resume= is set from kernel cmdline or not.
This commit is contained in:
Mike Yuan
2023-12-05 16:52:19 +08:00
parent 1fe536aa37
commit 24ab77c3cd
3 changed files with 4 additions and 8 deletions
@@ -204,13 +204,12 @@ void compare_hibernate_location_and_warn(const HibernateInfo *info) {
int r;
assert(info);
assert(info->from_efi || info->cmdline);
if (info->from_efi)
return;
if (!info->efi)
if (!info->cmdline || !info->efi)
return;
assert(info->device == info->cmdline->device);
if (!path_equal(info->cmdline->device, info->efi->device)) {
r = devnode_same(info->cmdline->device, info->efi->device);
if (r < 0)
@@ -256,11 +255,9 @@ int acquire_hibernate_info(HibernateInfo *ret) {
if (i.cmdline) {
i.device = i.cmdline->device;
i.offset = i.cmdline->offset;
i.from_efi = false;
} else if (i.efi) {
i.device = i.efi->device;
i.offset = i.efi->offset;
i.from_efi = true;
} else
return -ENODEV;
@@ -27,7 +27,6 @@ typedef struct EFIHibernateLocation {
typedef struct HibernateInfo {
const char *device;
uint64_t offset; /* in memory pages */
bool from_efi;
KernelHibernateLocation *cmdline;
EFIHibernateLocation *efi;
+1 -1
View File
@@ -59,7 +59,7 @@ static int run(int argc, char *argv[]) {
if (r <= 0)
return r;
if (arg_info.from_efi)
if (arg_info.efi)
clear_efi_hibernate_location();
}