[PATCH] kernel: power: swap: Suppress expected 'Image not found' error on Ubuntu

From: Shradha Gupta
Date: Thu Dec 15 2022 - 01:20:53 EST


In 'systemctl hibernate' if resume device is written to the sysfs
resume parameter, a software_resume() call is triggerred. This call
is expected to fail in swsusp_check() call with -EBUSY error and an
'Image not found' error message. This fix suppresses the expected
failure message from getting logged in Ubuntu setups where
CONFIG_DYNAMIC_DEBUG is enabled by default.

Signed-off-by: Shradha Gupta <shradhagupta@xxxxxxxxxxxxxxxxxxx>
---
kernel/power/swap.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 277434b6c0bf..9cbd3edc8339 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -1552,6 +1552,14 @@ int swsusp_check(void)
pr_debug("Image signature found, resuming\n");
} else {
error = PTR_ERR(hib_resume_bdev);
+ /*
+ * If this call is triggered by `systemctl hibernate`, the
+ * call is expected to fail with -EBUSY error.
+ * TODO: Figure out a better way to suppress the error msg
+ * in this case.
+ */
+ if (error == -EBUSY)
+ return error;
}

if (error)
--
2.37.2