55 lines
1.2 KiB
Diff
55 lines
1.2 KiB
Diff
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
|
|
--- a/kernel/power/hibernate.c
|
|
+++ b/kernel/power/hibernate.c
|
|
@@ -408,9 +408,18 @@ int hibernation_snapshot(int platform_mode)
|
|
if (error)
|
|
goto Close;
|
|
|
|
+ error = dpm_prepare(PMSG_FREEZE);
|
|
+ if (error)
|
|
+ goto Complete;
|
|
+
|
|
+ /* Preallocate image memory before freezing kernel threads and shutting down devices. */
|
|
+ error = hibernate_preallocate_memory();
|
|
+ if (error)
|
|
+ goto Complete;
|
|
+
|
|
error = freeze_kernel_threads();
|
|
if (error)
|
|
- goto Close;
|
|
+ goto Cleanup;
|
|
|
|
if (hibernation_test(TEST_FREEZER)) {
|
|
|
|
@@ -422,15 +431,6 @@ int hibernation_snapshot(int platform_mode)
|
|
goto Thaw;
|
|
}
|
|
|
|
- error = dpm_prepare(PMSG_FREEZE);
|
|
- if (error)
|
|
- goto Complete;
|
|
-
|
|
- /* Preallocate image memory before shutting down devices. */
|
|
- error = hibernate_preallocate_memory();
|
|
- if (error)
|
|
- goto Complete;
|
|
-
|
|
console_suspend_all();
|
|
pm_restrict_gfp_mask();
|
|
|
|
@@ -464,10 +464,12 @@ int hibernation_snapshot(int platform_mode)
|
|
platform_end(platform_mode);
|
|
return error;
|
|
|
|
- Complete:
|
|
- dpm_complete(PMSG_RECOVER);
|
|
Thaw:
|
|
thaw_kernel_threads();
|
|
+ Cleanup:
|
|
+ swsusp_free();
|
|
+ Complete:
|
|
+ dpm_complete(PMSG_RECOVER);
|
|
goto Close;
|
|
}
|
|
|