Commit 2e725a06 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Rafael J. Wysocki

PM / Hibernate: Return error code when alloc_image_page() fails

Currently we return 0 in swsusp_alloc() when alloc_image_page() fails.
Fix that.  Also remove unneeded "error" variable since the only
useful value of error is -ENOMEM.

[rjw: Fixed up the changelog and changed subject.]
Signed-off-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
Cc: stable@kernel.org
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent a2640111
...@@ -1519,11 +1519,8 @@ static int ...@@ -1519,11 +1519,8 @@ static int
swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm, swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm,
unsigned int nr_pages, unsigned int nr_highmem) unsigned int nr_pages, unsigned int nr_highmem)
{ {
int error = 0;
if (nr_highmem > 0) { if (nr_highmem > 0) {
error = get_highmem_buffer(PG_ANY); if (get_highmem_buffer(PG_ANY))
if (error)
goto err_out; goto err_out;
if (nr_highmem > alloc_highmem) { if (nr_highmem > alloc_highmem) {
nr_highmem -= alloc_highmem; nr_highmem -= alloc_highmem;
...@@ -1546,7 +1543,7 @@ swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm, ...@@ -1546,7 +1543,7 @@ swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm,
err_out: err_out:
swsusp_free(); swsusp_free();
return error; return -ENOMEM;
} }
asmlinkage int swsusp_save(void) asmlinkage int swsusp_save(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment