Linux Power Management development
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Karl-Heinz Schneider <karl-heinz@schneider-inet.de>,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
Date: Fri, 1 Dec 2017 16:27:53 +0100	[thread overview]
Message-ID: <20171201152753.7c5l47q2voqdgsdp@earth> (raw)
In-Reply-To: <20171107124322.mm3fqkrggw3zidrx@mwanda>

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

Hi,

On Tue, Nov 07, 2017 at 03:43:22PM +0300, Dan Carpenter wrote:
> The original code does this: "1 << (1 << 11)" which is undefined in C.
> 
> Fixes: dbc4deda03fe ("power: Adds support for Smart Battery System Manager")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Thanks, queued.

-- Sebastian

> From static analysis.  Not tested.
> 
> diff --git a/drivers/power/supply/sbs-manager.c b/drivers/power/supply/sbs-manager.c
> index ccb4217b9638..cb6e8f66c7a2 100644
> --- a/drivers/power/supply/sbs-manager.c
> +++ b/drivers/power/supply/sbs-manager.c
> @@ -183,7 +183,7 @@ static int sbsm_select(struct i2c_mux_core *muxc, u32 chan)
>  		return ret;
>  
>  	/* chan goes from 1 ... 4 */
> -	reg = 1 << BIT(SBSM_SMB_BAT_OFFSET + chan);
> +	reg = BIT(SBSM_SMB_BAT_OFFSET + chan);
>  	ret = sbsm_write_word(data->client, SBSM_CMD_BATSYSSTATE, reg);
>  	if (ret)
>  		dev_err(dev, "Failed to select channel %i\n", chan);

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2017-12-01 15:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 12:43 [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select() Dan Carpenter
2017-11-07 15:18 ` Phil Reid
2017-11-13 10:55 ` Sebastian Reichel
2017-11-13 11:02   ` Wolfram Sang
2017-11-15  7:45     ` Wolfram Sang
2017-11-15 10:05       ` Sebastian Reichel
2017-12-01 15:27 ` Sebastian Reichel [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=20171201152753.7c5l47q2voqdgsdp@earth \
    --to=sebastian.reichel@collabora.co.uk \
    --cc=dan.carpenter@oracle.com \
    --cc=karl-heinz@schneider-inet.de \
    --cc=kernel-janitors@vger.kernel.org \
    --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