Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-11-07 12:43 Dan Carpenter
  2017-11-07 15:18 ` Phil Reid
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dan Carpenter @ 2017-11-07 12:43 UTC (permalink / raw)
  To: Sebastian Reichel, Karl-Heinz Schneider; +Cc: linux-pm, kernel-janitors

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-01 15:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox