summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-06-15 00:20:44 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-16 09:04:20 -0700
commit8010204c43b1b1543b35972060a0dcaea2cce6fe (patch)
tree0b115279dd19e9b7e18bf926ba90882ba885c5a7
parent7cc0ab128f8866767113eece040dc838175901b2 (diff)
downloadlinux-3.10-8010204c43b1b1543b35972060a0dcaea2cce6fe.tar.gz
linux-3.10-8010204c43b1b1543b35972060a0dcaea2cce6fe.tar.bz2
linux-3.10-8010204c43b1b1543b35972060a0dcaea2cce6fe.zip
can: c_can: precedence error in c_can_chip_config()
commit d9cb9bd63eb27ac19f26a8547128c053f43a5da8 upstream. (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> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/can/c_can/c_can.c4
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 8dc84d66eea..86cd532c78f 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);