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
* pull-request: can: 2012-06-15
@ 2012-06-15 10:20 Marc Kleine-Budde
  2012-06-15 10:20 ` [PATCH] can: c_can: precedence error in c_can_chip_config() Marc Kleine-Budde
  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

Hello David,

here is a patch intended for v3.5, targeting net/master.

Dan Carpenter found a precedence error in c_can_chip_config() function
in the c_can driver, preventing that listen only + loop back mode can be
activated.

regards,
Marc


^ permalink raw reply	[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
  -- strict thread matches above, loose matches on Subject: below --
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).