All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-11-07 12:43 ` Dan Carpenter
  0 siblings, 0 replies; 14+ 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] 14+ messages in thread

* [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-11-07 12:43 ` Dan Carpenter
  0 siblings, 0 replies; 14+ 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] 14+ messages in thread

* Re: [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
  -1 siblings, 0 replies; 14+ messages in thread
From: Phil Reid @ 2017-11-07 15:18 UTC (permalink / raw)
  To: Dan Carpenter, Sebastian Reichel, Karl-Heinz Schneider
  Cc: linux-pm, kernel-janitors

On 7/11/2017 20:43, 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>
> ---
>>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);
> 
> 
Oops. That's my fault.

Reviewed-by: Phil Reid <preid@electromag.com.au>

-- 
Regards
Phil Reid

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-11-07 15:18   ` Phil Reid
  0 siblings, 0 replies; 14+ messages in thread
From: Phil Reid @ 2017-11-07 15:18 UTC (permalink / raw)
  To: Dan Carpenter, Sebastian Reichel, Karl-Heinz Schneider
  Cc: linux-pm, kernel-janitors

On 7/11/2017 20:43, 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>
> ---
>>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);
> 
> 
Oops. That's my fault.

Reviewed-by: Phil Reid <preid@electromag.com.au>

-- 
Regards
Phil Reid

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
  2017-11-07 12:43 ` Dan Carpenter
@ 2017-11-13 10:55   ` Sebastian Reichel
  -1 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-11-13 10:55 UTC (permalink / raw)
  To: Dan Carpenter, Wolfram Sang
  Cc: Karl-Heinz Schneider, linux-pm, kernel-janitors, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 1146 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>
> ---
> 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);

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

sbs-manager has been added to linux-next through the i2c tree due to
dependencies, so this one also needs to go through i2c.

-- Sebastian

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

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-11-13 10:55   ` Sebastian Reichel
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-11-13 10:55 UTC (permalink / raw)
  To: Dan Carpenter, Wolfram Sang
  Cc: Karl-Heinz Schneider, linux-pm, kernel-janitors, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 1146 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>
> ---
> 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);

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

sbs-manager has been added to linux-next through the i2c tree due to
dependencies, so this one also needs to go through i2c.

-- Sebastian

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

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
  2017-11-13 10:55   ` Sebastian Reichel
@ 2017-11-13 11:02     ` Wolfram Sang
  -1 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2017-11-13 11:02 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dan Carpenter, Karl-Heinz Schneider, linux-pm, kernel-janitors,
	linux-i2c

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

On Mon, Nov 13, 2017 at 11:55:24AM +0100, Sebastian Reichel wrote:
> 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>
> > ---
> > 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);
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> 
> sbs-manager has been added to linux-next through the i2c tree due to
> dependencies, so this one also needs to go through i2c.

I want to send Linus my pull request early this time (like today or
tomorrow). So, you either apply this patch then yourself afterwards on
top of linus' tree. Or I send it to him, but then I'd need the original
patch bounced or resent. Both fine with me.


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

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-11-13 11:02     ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2017-11-13 11:02 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dan Carpenter, Karl-Heinz Schneider, linux-pm, kernel-janitors,
	linux-i2c

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

On Mon, Nov 13, 2017 at 11:55:24AM +0100, Sebastian Reichel wrote:
> 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>
> > ---
> > 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);
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> 
> sbs-manager has been added to linux-next through the i2c tree due to
> dependencies, so this one also needs to go through i2c.

I want to send Linus my pull request early this time (like today or
tomorrow). So, you either apply this patch then yourself afterwards on
top of linus' tree. Or I send it to him, but then I'd need the original
patch bounced or resent. Both fine with me.


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

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
  2017-11-13 11:02     ` Wolfram Sang
@ 2017-11-15  7:45       ` Wolfram Sang
  -1 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2017-11-15  7:45 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dan Carpenter, Karl-Heinz Schneider, linux-pm, kernel-janitors,
	linux-i2c

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


> > >  	/* 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);
> > 
> > Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> > 
> > sbs-manager has been added to linux-next through the i2c tree due to
> > dependencies, so this one also needs to go through i2c.
> 
> I want to send Linus my pull request early this time (like today or
> tomorrow). So, you either apply this patch then yourself afterwards on
> top of linus' tree. Or I send it to him, but then I'd need the original
> patch bounced or resent. Both fine with me.

The sbs-manager code is in linus' tree now. How would you like to
proceed?


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

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-11-15  7:45       ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2017-11-15  7:45 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dan Carpenter, Karl-Heinz Schneider, linux-pm, kernel-janitors,
	linux-i2c

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


> > >  	/* 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);
> > 
> > Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> > 
> > sbs-manager has been added to linux-next through the i2c tree due to
> > dependencies, so this one also needs to go through i2c.
> 
> I want to send Linus my pull request early this time (like today or
> tomorrow). So, you either apply this patch then yourself afterwards on
> top of linus' tree. Or I send it to him, but then I'd need the original
> patch bounced or resent. Both fine with me.

The sbs-manager code is in linus' tree now. How would you like to
proceed?


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

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
  2017-11-15  7:45       ` Wolfram Sang
@ 2017-11-15 10:05         ` Sebastian Reichel
  -1 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-11-15 10:05 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Dan Carpenter, Karl-Heinz Schneider, linux-pm, kernel-janitors,
	linux-i2c

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

Hi,

On Wed, Nov 15, 2017 at 08:45:44AM +0100, Wolfram Sang wrote:
> > > >  	/* 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);
> > > 
> > > Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> > > 
> > > sbs-manager has been added to linux-next through the i2c tree due to
> > > dependencies, so this one also needs to go through i2c.
> > 
> > I want to send Linus my pull request early this time (like today or
> > tomorrow). So, you either apply this patch then yourself afterwards on
> > top of linus' tree. Or I send it to him, but then I'd need the original
> > patch bounced or resent. Both fine with me.
> 
> The sbs-manager code is in linus' tree now. How would you like to
> proceed?

I plan to send my pull request today and will take it during the -rc phase
through the power-supply tree. Thanks,

-- Sebastian

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

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-11-15 10:05         ` Sebastian Reichel
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-11-15 10:05 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Dan Carpenter, Karl-Heinz Schneider, linux-pm, kernel-janitors,
	linux-i2c

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

Hi,

On Wed, Nov 15, 2017 at 08:45:44AM +0100, Wolfram Sang wrote:
> > > >  	/* 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);
> > > 
> > > Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> > > 
> > > sbs-manager has been added to linux-next through the i2c tree due to
> > > dependencies, so this one also needs to go through i2c.
> > 
> > I want to send Linus my pull request early this time (like today or
> > tomorrow). So, you either apply this patch then yourself afterwards on
> > top of linus' tree. Or I send it to him, but then I'd need the original
> > patch bounced or resent. Both fine with me.
> 
> The sbs-manager code is in linus' tree now. How would you like to
> proceed?

I plan to send my pull request today and will take it during the -rc phase
through the power-supply tree. Thanks,

-- Sebastian

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

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
  2017-11-07 12:43 ` Dan Carpenter
@ 2017-12-01 15:27   ` Sebastian Reichel
  -1 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-12-01 15:27 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Karl-Heinz Schneider, linux-pm, kernel-janitors

[-- 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 --]

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

* Re: [PATCH] power: supply: sbs-message: double left shift bug in sbsm_select()
@ 2017-12-01 15:27   ` Sebastian Reichel
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-12-01 15:27 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Karl-Heinz Schneider, linux-pm, kernel-janitors

[-- 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 --]

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

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

Thread overview: 14+ 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 12:43 ` Dan Carpenter
2017-11-07 15:18 ` Phil Reid
2017-11-07 15:18   ` Phil Reid
2017-11-13 10:55 ` Sebastian Reichel
2017-11-13 10:55   ` Sebastian Reichel
2017-11-13 11:02   ` Wolfram Sang
2017-11-13 11:02     ` Wolfram Sang
2017-11-15  7:45     ` Wolfram Sang
2017-11-15  7:45       ` Wolfram Sang
2017-11-15 10:05       ` Sebastian Reichel
2017-11-15 10:05         ` Sebastian Reichel
2017-12-01 15:27 ` Sebastian Reichel
2017-12-01 15:27   ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.