From: Pavel Machek Date: Fri, 8 Jul 2005 00:56:43 +0000 (-0700) Subject: [PATCH] pm: Fix resume from initrd X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3efa147ad7608196639882ba4075b376f306fe16;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] pm: Fix resume from initrd Move device name resolution code around so that it is not called from resume-from-initrd. name_to_dev_t may be unavailable at that point. Signed-off-by: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/power/disk.c b/kernel/power/disk.c index fb8de63c2919..c51a4d96d4eb 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c @@ -234,6 +234,16 @@ static int software_resume(void) { int error; + if (!swsusp_resume_device) { + if (!strlen(resume_file)) + return -ENOENT; + swsusp_resume_device = name_to_dev_t(resume_file); + pr_debug("swsusp: Resume From Partition %s\n", resume_file); + } else { + pr_debug("swsusp: Resume From Partition %d:%d\n", + MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); + } + if (noresume) { /** * FIXME: If noresume is specified, we need to find the partition diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index c285fc5a2320..d82c1f7d0a60 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c @@ -1356,16 +1356,6 @@ int swsusp_check(void) { int error; - if (!swsusp_resume_device) { - if (!strlen(resume_file)) - return -ENOENT; - swsusp_resume_device = name_to_dev_t(resume_file); - pr_debug("swsusp: Resume From Partition %s\n", resume_file); - } else { - pr_debug("swsusp: Resume From Partition %d:%d\n", - MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); - } - resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); if (!IS_ERR(resume_bdev)) { set_blocksize(resume_bdev, PAGE_SIZE);