Linux Power Management development
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-pm@vger.kernel.org
Subject: Re: [PATCH 3.7+stable] pm: fix wrong error-checking condition
Date: Fri, 23 Nov 2012 21:36:55 +0100	[thread overview]
Message-ID: <2410876.0MhetLSqTZ@vostro.rjw.lan> (raw)
In-Reply-To: <Pine.LNX.4.64.1211231601040.14984@axis700.grange>

On Friday, November 23, 2012 04:02:56 PM Guennadi Liakhovetski wrote:
> dev_pm_qos_add_request() can return 0, 1, or a negative error code,
> therefore the correct error test is "if (error < 0)." Checking just for
> non-zero return code leads to erroneous setting of the req->dev pointer
> to NULL, which then leads to a repeated call to
> dev_pm_qos_add_ancestor_request() in st1232_ts_irq_handler(). This in turn
> leads to an Oops, when the I2C host adapter is unloaded and reloaded again
> because of the inconsistent state of its QoS request list.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> 
> Hi Rafael, please push to 3.7 and to stable.

I will, thanks for the fix!

Rafael


>  drivers/base/power/qos.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
> index 74a67e0..fbbd4ed 100644
> --- a/drivers/base/power/qos.c
> +++ b/drivers/base/power/qos.c
> @@ -451,7 +451,7 @@ int dev_pm_qos_add_ancestor_request(struct device *dev,
>  	if (ancestor)
>  		error = dev_pm_qos_add_request(ancestor, req, value);
>  
> -	if (error)
> +	if (error < 0)
>  		req->dev = NULL;
>  
>  	return error;
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2012-11-23 20:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23 15:02 [PATCH 3.7+stable] pm: fix wrong error-checking condition Guennadi Liakhovetski
2012-11-23 20:36 ` 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=2410876.0MhetLSqTZ@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-pm@vger.kernel.org \
    /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