]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
PM / Hibernate: Return error code when alloc_image_page() fails
authorStanislaw Gruszka <stf_xl@pop3.wp.pl>
Sat, 12 Feb 2011 20:06:51 +0000 (21:06 +0100)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 26 Jun 2011 16:46:45 +0000 (12:46 -0400)
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 <stf_xl@wp.pl>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
kernel/power/snapshot.c

index be861c26dda7c70a35e775b5cb93756c7077754b..0652dccdb698e729d7cdf6b369d244e69bfed7ec 100644 (file)
@@ -1467,11 +1467,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;
@@ -1494,7 +1491,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)