netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] can: c_can: precedence error in c_can_chip_config()
@ 2012-06-09 15:56 Dan Carpenter
  2012-06-10 17:52 ` Marc Kleine-Budde
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2012-06-09 15:56 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: Marc Kleine-Budde, AnilKumar Ch, David S. Miller, Jiri Kosina,
	linux-can, netdev, kernel-janitors

(CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
is zero so the condition is never true.  The intent here was to test
that both flags were set.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is a static checker fix.  I'm not super familiar with the c_can
code.

diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index e2ce508..eea6608 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -594,8 +594,8 @@ static void c_can_chip_config(struct net_device *dev)
 	priv->write_reg(priv, C_CAN_CTRL_REG,
 			CONTROL_ENABLE_AR);
 
-	if (priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY &
-					CAN_CTRLMODE_LOOPBACK)) {
+	if ((priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) &&
+	    (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)) {
 		/* loopback + silent mode : useful for hot self-test */
 		priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_EIE |
 				CONTROL_SIE | CONTROL_IE | CONTROL_TEST);

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

* Re: [patch] can: c_can: precedence error in c_can_chip_config()
  2012-06-09 15:56 [patch] can: c_can: precedence error in c_can_chip_config() Dan Carpenter
@ 2012-06-10 17:52 ` Marc Kleine-Budde
  2012-06-11 17:42   ` Oliver Hartkopp
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Kleine-Budde @ 2012-06-10 17:52 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Wolfgang Grandegger, AnilKumar Ch, David S. Miller, Jiri Kosina,
	linux-can, netdev, kernel-janitors

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

On 06/09/2012 05:56 PM, Dan Carpenter wrote:
> (CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
> is zero so the condition is never true.  The intent here was to test
> that both flags were set.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is a static checker fix.  I'm not super familiar with the c_can
> code.

Good catch. Applied to can-next.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

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

* Re: [patch] can: c_can: precedence error in c_can_chip_config()
  2012-06-10 17:52 ` Marc Kleine-Budde
@ 2012-06-11 17:42   ` Oliver Hartkopp
  2012-06-11 17:51     ` Marc Kleine-Budde
  2012-06-12  9:37     ` Marc Kleine-Budde
  0 siblings, 2 replies; 8+ messages in thread
From: Oliver Hartkopp @ 2012-06-11 17:42 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Dan Carpenter, Wolfgang Grandegger, AnilKumar Ch,
	David S. Miller, Jiri Kosina, linux-can, netdev, kernel-janitors

On 10.06.2012 19:52, Marc Kleine-Budde wrote:

> On 06/09/2012 05:56 PM, Dan Carpenter wrote:
>> (CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
>> is zero so the condition is never true.  The intent here was to test
>> that both flags were set.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>> This is a static checker fix.  I'm not super familiar with the c_can
>> code.
> 
> Good catch. Applied to can-next.
> 
> Marc
> 


Shouldn't this fix go through the net-tree and stable instead of net-next?

Regards,
Oliver


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

* Re: [patch] can: c_can: precedence error in c_can_chip_config()
  2012-06-11 17:42   ` Oliver Hartkopp
@ 2012-06-11 17:51     ` Marc Kleine-Budde
  2012-06-12  9:37     ` Marc Kleine-Budde
  1 sibling, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2012-06-11 17:51 UTC (permalink / raw)
  To: Oliver Hartkopp
  Cc: Dan Carpenter, Wolfgang Grandegger, AnilKumar Ch,
	David S. Miller, Jiri Kosina, linux-can, netdev, kernel-janitors

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

On 06/11/2012 07:42 PM, Oliver Hartkopp wrote:
> On 10.06.2012 19:52, Marc Kleine-Budde wrote:
> 
>> On 06/09/2012 05:56 PM, Dan Carpenter wrote:
>>> (CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
>>> is zero so the condition is never true.  The intent here was to test
>>> that both flags were set.
>>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>> ---
>>> This is a static checker fix.  I'm not super familiar with the c_can
>>> code.
>>
>> Good catch. Applied to can-next.
>>
>> Marc
>>
> 
> 
> Shouldn't this fix go through the net-tree and stable instead of net-next?

Indeed.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

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

* Re: [patch] can: c_can: precedence error in c_can_chip_config()
  2012-06-11 17:42   ` Oliver Hartkopp
  2012-06-11 17:51     ` Marc Kleine-Budde
@ 2012-06-12  9:37     ` Marc Kleine-Budde
  2012-06-12 11:01       ` Oliver Hartkopp
  1 sibling, 1 reply; 8+ messages in thread
From: Marc Kleine-Budde @ 2012-06-12  9:37 UTC (permalink / raw)
  To: Oliver Hartkopp
  Cc: Dan Carpenter, Wolfgang Grandegger, AnilKumar Ch,
	David S. Miller, Jiri Kosina, linux-can, netdev, kernel-janitors

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

On 06/11/2012 07:42 PM, Oliver Hartkopp wrote:
> On 10.06.2012 19:52, Marc Kleine-Budde wrote:
> 
>> On 06/09/2012 05:56 PM, Dan Carpenter wrote:
>>> (CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
>>> is zero so the condition is never true.  The intent here was to test
>>> that both flags were set.
>>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>> ---
>>> This is a static checker fix.  I'm not super familiar with the c_can
>>> code.
>>
>> Good catch. Applied to can-next.
>>
>> Marc
>>
> 
> 
> Shouldn't this fix go through the net-tree and stable instead of net-next?

Can I add your Acked-by ... when adding to net?

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

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

* Re: [patch] can: c_can: precedence error in c_can_chip_config()
  2012-06-12  9:37     ` Marc Kleine-Budde
@ 2012-06-12 11:01       ` Oliver Hartkopp
  0 siblings, 0 replies; 8+ messages in thread
From: Oliver Hartkopp @ 2012-06-12 11:01 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Dan Carpenter, Wolfgang Grandegger, AnilKumar Ch,
	David S. Miller, Jiri Kosina, linux-can, netdev, kernel-janitors

On 12.06.2012 11:37, Marc Kleine-Budde wrote:

> On 06/11/2012 07:42 PM, Oliver Hartkopp wrote:
>> On 10.06.2012 19:52, Marc Kleine-Budde wrote:
>>
>>> On 06/09/2012 05:56 PM, Dan Carpenter wrote:
>>>> (CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
>>>> is zero so the condition is never true.  The intent here was to test
>>>> that both flags were set.
>>>>
>>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>> ---
>>>> This is a static checker fix.  I'm not super familiar with the c_can
>>>> code.
>>>
>>> Good catch. Applied to can-next.
>>>
>>> Marc
>>>
>>
>>
>> Shouldn't this fix go through the net-tree and stable instead of net-next?
> 
> Can I add your Acked-by ... when adding to net?


Yes you can :-)

Oliver

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

* Re: [PATCH] can: c_can: precedence error in c_can_chip_config()
  2012-06-15 10:20 ` [PATCH] can: c_can: precedence error in c_can_chip_config() Marc Kleine-Budde
@ 2012-06-15 22:26   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2012-06-15 22:26 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, dan.carpenter

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Fri, 15 Jun 2012 12:20:44 +0200

> From: Dan Carpenter <dan.carpenter@oracle.com>
> 
> (CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
> is zero so the condition is never true.  The intent here was to test
> that both flags were set.
> 
> Cc: <stable@kernel.org> # 2.6.39+
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Applied.

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

* [PATCH] can: c_can: precedence error in c_can_chip_config()
  2012-06-15 10:20 pull-request: can: 2012-06-15 Marc Kleine-Budde
@ 2012-06-15 10:20 ` Marc Kleine-Budde
  2012-06-15 22:26   ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Kleine-Budde @ 2012-06-15 10:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can, Dan Carpenter, Marc Kleine-Budde

From: Dan Carpenter <dan.carpenter@oracle.com>

(CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
is zero so the condition is never true.  The intent here was to test
that both flags were set.

Cc: <stable@kernel.org> # 2.6.39+
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/c_can/c_can.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 8dc84d6..86cd532 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -590,8 +590,8 @@ static void c_can_chip_config(struct net_device *dev)
 	priv->write_reg(priv, &priv->regs->control,
 			CONTROL_ENABLE_AR);
 
-	if (priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY &
-					CAN_CTRLMODE_LOOPBACK)) {
+	if ((priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) &&
+	    (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)) {
 		/* loopback + silent mode : useful for hot self-test */
 		priv->write_reg(priv, &priv->regs->control, CONTROL_EIE |
 				CONTROL_SIE | CONTROL_IE | CONTROL_TEST);
-- 
1.7.4.1


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

end of thread, other threads:[~2012-06-15 22:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-09 15:56 [patch] can: c_can: precedence error in c_can_chip_config() Dan Carpenter
2012-06-10 17:52 ` Marc Kleine-Budde
2012-06-11 17:42   ` Oliver Hartkopp
2012-06-11 17:51     ` Marc Kleine-Budde
2012-06-12  9:37     ` Marc Kleine-Budde
2012-06-12 11:01       ` Oliver Hartkopp
2012-06-15 10:20 pull-request: can: 2012-06-15 Marc Kleine-Budde
2012-06-15 10:20 ` [PATCH] can: c_can: precedence error in c_can_chip_config() Marc Kleine-Budde
2012-06-15 22:26   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).