Netdev List
 help / color / mirror / Atom feed
From: Luu An Phu <phu.luuan@nxp.com>
To: wg@grandegger.com, mkl@pengutronix.de
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org,
	stefan-gabriel.mirea@nxp.com, "phu.luuan" <phu.luuan@nxp.com>
Subject: [PATCH] flex_can: Correct the checking for frame length in flexcan_start_xmit()
Date: Tue,  2 Jan 2018 10:44:18 +0700	[thread overview]
Message-ID: <1514864658-13194-1-git-send-email-phu.luuan@nxp.com> (raw)

From: "phu.luuan" <phu.luuan@nxp.com>

The flexcan_start_xmit() function compares the frame length with data register
length to write frame content into data[0] and data[1] register. Data register
length is 4 bytes and frame maximum length is 8 bytes.

Fix the check that compares frame length with 3. Because the register length
is 4.

Signed-off-by: Luu An Phu <phu.luuan@nxp.com>
---
 drivers/net/can/flexcan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 0626dcf..760d2c0 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -526,7 +526,7 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		data = be32_to_cpup((__be32 *)&cf->data[0]);
 		flexcan_write(data, &priv->tx_mb->data[0]);
 	}
-	if (cf->can_dlc > 3) {
+	if (cf->can_dlc > 4) {
 		data = be32_to_cpup((__be32 *)&cf->data[4]);
 		flexcan_write(data, &priv->tx_mb->data[1]);
 	}
-- 
1.9.1


             reply	other threads:[~2018-01-02  3:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-02  3:44 Luu An Phu [this message]
2018-01-02 11:17 ` [PATCH] flex_can: Correct the checking for frame length in flexcan_start_xmit() Oliver Hartkopp
2018-01-03 10:35 ` Marc Kleine-Budde

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=1514864658-13194-1-git-send-email-phu.luuan@nxp.com \
    --to=phu.luuan@nxp.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=stefan-gabriel.mirea@nxp.com \
    --cc=wg@grandegger.com \
    /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