Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PM: hibernate: Emit an error when image writing fails

If image writing fails, a return code is passed up to the caller, but
none of the callers log anything to the log and so the only record
of it is the return code that userspace gets.

Adjust the logging so that the image size and speed of writing is
only emitted on success and if there is an error, it's saved to the
logs.

Fixes: a06c6f5d3cc9 ("PM: hibernate: Move to crypto APIs for LZO compression")
Reported-by: Askar Safin <safinaskar@gmail.com>
Closes: https://lore.kernel.org/linux-pm/20251105180506.137448-1-safinaskar@gmail.com/
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Tested-by: Askar Safin <safinaskar@gmail.com>
Cc: 6.9+ <stable@vger.kernel.org> # 6.9+
[ rjw: Added missing braces after "else", changelog edits ]
Link: https://patch.msgid.link/20251106045158.3198061-2-superm1@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Mario Limonciello (AMD) and committed by
Rafael J. Wysocki
62b9ca17 6146a0f1

+7 -4
+7 -4
kernel/power/swap.c
··· 877 877 stop = ktime_get(); 878 878 if (!ret) 879 879 ret = err2; 880 - if (!ret) 880 + if (!ret) { 881 + swsusp_show_speed(start, stop, nr_to_write, "Wrote"); 882 + pr_info("Image size after compression: %d kbytes\n", 883 + (atomic_read(&compressed_size) / 1024)); 881 884 pr_info("Image saving done\n"); 882 - swsusp_show_speed(start, stop, nr_to_write, "Wrote"); 883 - pr_info("Image size after compression: %d kbytes\n", 884 - (atomic_read(&compressed_size) / 1024)); 885 + } else { 886 + pr_err("Image saving failed: %d\n", ret); 887 + } 885 888 886 889 out_clean: 887 890 hib_finish_batch(&hb);