public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Stanislaw Gruszka <stf_xl@pop3.wp.pl>
Cc: linux-pm@lists.linux-foundation.org
Subject: Re: [PATCH] swsusp: fix return value when alloc fail
Date: Sat, 12 Feb 2011 21:09:15 +0100	[thread overview]
Message-ID: <201102122109.15966.rjw@sisk.pl> (raw)
In-Reply-To: <20110212172603.GA2721@localhost.localdomain>

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)
> 

      reply	other threads:[~2011-02-12 20:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-12 17:26 [PATCH] swsusp: fix return value when alloc fail Stanislaw Gruszka
2011-02-12 20:09 ` Rafael J. Wysocki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201102122109.15966.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=stf_xl@pop3.wp.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox