Commit 2e725a065b0153f0c449318da1923a120477633d
Committed by
Rafael J. Wysocki
1 parent
a2640111d5
Exists in
master
and in
4 other branches
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: Stanislaw Gruszka <stf_xl@wp.pl> Cc: stable@kernel.org Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Showing 1 changed file with 2 additions and 5 deletions Side-by-side Diff
kernel/power/snapshot.c
... | ... | @@ -1519,11 +1519,8 @@ |
1519 | 1519 | swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm, |
1520 | 1520 | unsigned int nr_pages, unsigned int nr_highmem) |
1521 | 1521 | { |
1522 | - int error = 0; | |
1523 | - | |
1524 | 1522 | if (nr_highmem > 0) { |
1525 | - error = get_highmem_buffer(PG_ANY); | |
1526 | - if (error) | |
1523 | + if (get_highmem_buffer(PG_ANY)) | |
1527 | 1524 | goto err_out; |
1528 | 1525 | if (nr_highmem > alloc_highmem) { |
1529 | 1526 | nr_highmem -= alloc_highmem; |
... | ... | @@ -1546,7 +1543,7 @@ |
1546 | 1543 | |
1547 | 1544 | err_out: |
1548 | 1545 | swsusp_free(); |
1549 | - return error; | |
1546 | + return -ENOMEM; | |
1550 | 1547 | } |
1551 | 1548 | |
1552 | 1549 | asmlinkage int swsusp_save(void) |