public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Qiao Zhou <zhouqiao@marvell.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] mfd: 88pm80x: Double shifting bug in suspend/resume
Date: Tue, 9 Aug 2016 14:50:39 +0100	[thread overview]
Message-ID: <20160809135039.GK5243@dell> (raw)
In-Reply-To: <20160804052656.GG775@mwanda>

On Thu, 04 Aug 2016, Dan Carpenter wrote:

> set_bit() and clear_bit() take the bit number so this code is really
> doing "1 << (1 << irq)" which is a double shift bug.  It's done
> consistently so it won't cause a problem unless "irq" is more than 4.
> 
> Fixes: 70c6cce04066 ('mfd: Support 88pm80x in 80x driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.

> diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
> index d409ceb..c118a7e 100644
> --- a/include/linux/mfd/88pm80x.h
> +++ b/include/linux/mfd/88pm80x.h
> @@ -350,7 +350,7 @@ static inline int pm80x_dev_suspend(struct device *dev)
>  	int irq = platform_get_irq(pdev, 0);
>  
>  	if (device_may_wakeup(dev))
> -		set_bit((1 << irq), &chip->wu_flag);
> +		set_bit(irq, &chip->wu_flag);
>  
>  	return 0;
>  }
> @@ -362,7 +362,7 @@ static inline int pm80x_dev_resume(struct device *dev)
>  	int irq = platform_get_irq(pdev, 0);
>  
>  	if (device_may_wakeup(dev))
> -		clear_bit((1 << irq), &chip->wu_flag);
> +		clear_bit(irq, &chip->wu_flag);
>  
>  	return 0;
>  }

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

      reply	other threads:[~2016-08-09 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04  5:26 [patch] mfd: 88pm80x: Double shifting bug in suspend/resume Dan Carpenter
2016-08-09 13:50 ` Lee Jones [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=20160809135039.GK5243@dell \
    --to=lee.jones@linaro.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhouqiao@marvell.com \
    /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