Skip to content

Commit

Permalink
power: supply: sbs-message: double left shift bug in sbsm_select()
Browse files Browse the repository at this point in the history
[ Upstream commit 7d54d0d ]

The original code does this: "1 << (1 << 11)" which is undefined in C.

Fixes: dbc4ded ("power: Adds support for Smart Battery System Manager")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Mar 19, 2018
1 parent 8a74748 commit fadaf42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/power/supply/sbs-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fadaf42

Please sign in to comment.