From: Stanislaw Gruszka Date: Sat, 12 Feb 2011 20:06:51 +0000 (+0100) Subject: PM / Hibernate: Return error code when alloc_image_page() fails X-Git-Tag: v2.6.35.12~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f153f5f88f2a1e5ad38a328b144bd3a5b1f5dca3;p=thirdparty%2Fkernel%2Fstable.git PM / Hibernate: Return error code when alloc_image_page() fails commit 2e725a065b0153f0c449318da1923a120477633d upstream. 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 Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andi Kleen --- diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 7fa52b5ce88d1..1a9b326073393 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1512,11 +1512,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; @@ -1539,7 +1536,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)