Skip to content

Commit

Permalink
PM / Hibernate: Return error code when alloc_image_page() fails
Browse files Browse the repository at this point in the history
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: Stanislaw Gruszka <[email protected]>
Cc: [email protected]
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
Stanislaw Gruszka authored and rjwysocki committed Feb 16, 2011
1 parent a264011 commit 2e725a0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions kernel/power/snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,11 +1519,8 @@ static int
swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm,
unsigned int nr_pages, unsigned int nr_highmem)
{
int error = 0;

if (nr_highmem > 0) {
error = get_highmem_buffer(PG_ANY);
if (error)
if (get_highmem_buffer(PG_ANY))
goto err_out;
if (nr_highmem > alloc_highmem) {
nr_highmem -= alloc_highmem;
Expand All @@ -1546,7 +1543,7 @@ swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm,

err_out:
swsusp_free();
return error;
return -ENOMEM;
}

asmlinkage int swsusp_save(void)
Expand Down

0 comments on commit 2e725a0

Please sign in to comment.