linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-can@vger.kernel.org,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH] can: c_can: precedence error in c_can_chip_config()
Date: Fri, 15 Jun 2012 12:20:44 +0200	[thread overview]
Message-ID: <1339755644-6686-2-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1339755644-6686-1-git-send-email-mkl@pengutronix.de>

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


  reply	other threads:[~2012-06-15 10:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 10:20 pull-request: can: 2012-06-15 Marc Kleine-Budde
2012-06-15 10:20 ` Marc Kleine-Budde [this message]
2012-06-15 22:26   ` [PATCH] can: c_can: precedence error in c_can_chip_config() David Miller
2012-06-15 22:26 ` pull-request: can: 2012-06-15 David Miller
  -- strict thread matches above, loose matches on Subject: below --
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339755644-6686-2-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).