* [PATCH] flex_can: Correct the checking for frame length in flexcan_start_xmit()
@ 2018-01-02 3:44 Luu An Phu
2018-01-02 11:17 ` Oliver Hartkopp
2018-01-03 10:35 ` Marc Kleine-Budde
0 siblings, 2 replies; 3+ messages in thread
From: Luu An Phu @ 2018-01-02 3:44 UTC (permalink / raw)
To: wg, mkl; +Cc: linux-can, netdev, stefan-gabriel.mirea, phu.luuan
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] flex_can: Correct the checking for frame length in flexcan_start_xmit()
2018-01-02 3:44 [PATCH] flex_can: Correct the checking for frame length in flexcan_start_xmit() Luu An Phu
@ 2018-01-02 11:17 ` Oliver Hartkopp
2018-01-03 10:35 ` Marc Kleine-Budde
1 sibling, 0 replies; 3+ messages in thread
From: Oliver Hartkopp @ 2018-01-02 11:17 UTC (permalink / raw)
To: Luu An Phu, wg, mkl; +Cc: linux-can, netdev, stefan-gabriel.mirea
On 01/02/2018 04:44 AM, Luu An Phu wrote:
> 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>
Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net>
Thanks for this improvement!
Best regards,
Oliver
> ---
> 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]);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] flex_can: Correct the checking for frame length in flexcan_start_xmit()
2018-01-02 3:44 [PATCH] flex_can: Correct the checking for frame length in flexcan_start_xmit() Luu An Phu
2018-01-02 11:17 ` Oliver Hartkopp
@ 2018-01-03 10:35 ` Marc Kleine-Budde
1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2018-01-03 10:35 UTC (permalink / raw)
To: Luu An Phu, wg; +Cc: linux-can, netdev, stefan-gabriel.mirea
[-- Attachment #1.1: Type: text/plain, Size: 766 bytes --]
On 01/02/2018 04:44 AM, Luu An Phu wrote:
> 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>
Applied to can.
Tnx,
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: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-03 10:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02 3:44 [PATCH] flex_can: Correct the checking for frame length in flexcan_start_xmit() Luu An Phu
2018-01-02 11:17 ` Oliver Hartkopp
2018-01-03 10:35 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox