public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] swsusp: fix return value when alloc fail
@ 2011-02-12 17:26 Stanislaw Gruszka
  2011-02-12 20:09 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislaw Gruszka @ 2011-02-12 17:26 UTC (permalink / raw)
  To: Pavel Machek, Rafael J. Wysocki; +Cc: linux-pm

Currently we return 0 in swsusp_alloc() when alloc_image_page() fail.
Patch fixes that. Also remove unneeded "error" variable since only
possible error is -ENOMEM.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
---
 kernel/power/snapshot.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 0dac75e..64db648 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -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;
@@ -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)
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] swsusp: fix return value when alloc fail
  2011-02-12 17:26 [PATCH] swsusp: fix return value when alloc fail Stanislaw Gruszka
@ 2011-02-12 20:09 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2011-02-12 20:09 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-pm

On Saturday, February 12, 2011, Stanislaw Gruszka wrote:
> Currently we return 0 in swsusp_alloc() when alloc_image_page() fail.
> Patch fixes that. Also remove unneeded "error" variable since only
> possible error is -ENOMEM.
> 
> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>

Good catch, thanks!  Patch applied to suspend-2.6/linux-next.

Rafael


> ---
>  kernel/power/snapshot.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
> index 0dac75e..64db648 100644
> --- a/kernel/power/snapshot.c
> +++ b/kernel/power/snapshot.c
> @@ -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;
> @@ -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)
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-12 20:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-12 17:26 [PATCH] swsusp: fix return value when alloc fail Stanislaw Gruszka
2011-02-12 20:09 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox