netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: fix SJA1000 dlc for RTR packets
@ 2011-05-02 14:50 Kurt Van Dijck
       [not found] ` <20110502145048.GF338-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
  2011-05-05 18:02 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Kurt Van Dijck @ 2011-05-02 14:50 UTC (permalink / raw)
  To: socketcan-core, netdev

RTR frames do have a valid data length code on CAN.
The driver for SJA1000 did not handle that situation properly.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
---
 drivers/net/can/sja1000/sja1000.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index a358ea9..f501bba 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -346,10 +346,10 @@ static void sja1000_rx(struct net_device *dev)
 		    | (priv->read_reg(priv, REG_ID2) >> 5);
 	}
 
+	cf->can_dlc = get_can_dlc(fi & 0x0F);
 	if (fi & FI_RTR) {
 		id |= CAN_RTR_FLAG;
 	} else {
-		cf->can_dlc = get_can_dlc(fi & 0x0F);
 		for (i = 0; i < cf->can_dlc; i++)
 			cf->data[i] = priv->read_reg(priv, dreg++);
 	}

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: fix SJA1000 dlc for RTR packets
       [not found] ` <20110502145048.GF338-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
@ 2011-05-02 15:15   ` Marc Kleine-Budde
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2011-05-02 15:15 UTC (permalink / raw)
  To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA


[-- Attachment #1.1: Type: text/plain, Size: 1520 bytes --]

On 05/02/2011 04:50 PM, Kurt Van Dijck wrote:
> RTR frames do have a valid data length code on CAN.
> The driver for SJA1000 did not handle that situation properly.

Looks good!
> 
> Signed-off-by: Kurt Van Dijck <kurt.van.dijck-/BeEPy95v10@public.gmane.org>
Acked-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
>  drivers/net/can/sja1000/sja1000.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
> index a358ea9..f501bba 100644
> --- a/drivers/net/can/sja1000/sja1000.c
> +++ b/drivers/net/can/sja1000/sja1000.c
> @@ -346,10 +346,10 @@ static void sja1000_rx(struct net_device *dev)
>  		    | (priv->read_reg(priv, REG_ID2) >> 5);
>  	}
>  
> +	cf->can_dlc = get_can_dlc(fi & 0x0F);
>  	if (fi & FI_RTR) {
>  		id |= CAN_RTR_FLAG;
>  	} else {
> -		cf->can_dlc = get_can_dlc(fi & 0x0F);
>  		for (i = 0; i < cf->can_dlc; i++)
>  			cf->data[i] = priv->read_reg(priv, dreg++);
>  	}
> _______________________________________________
> Socketcan-core mailing list
> Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
> https://lists.berlios.de/mailman/listinfo/socketcan-core


-- 
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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 188 bytes --]

_______________________________________________
Socketcan-core mailing list
Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-core

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: fix SJA1000 dlc for RTR packets
  2011-05-02 14:50 [PATCH] can: fix SJA1000 dlc for RTR packets Kurt Van Dijck
       [not found] ` <20110502145048.GF338-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
@ 2011-05-05 18:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2011-05-05 18:02 UTC (permalink / raw)
  To: kurt.van.dijck; +Cc: socketcan-core, netdev

From: Kurt Van Dijck <kurt.van.dijck@eia.be>
Date: Mon, 2 May 2011 16:50:48 +0200

> RTR frames do have a valid data length code on CAN.
> The driver for SJA1000 did not handle that situation properly.
> 
> Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-05 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-02 14:50 [PATCH] can: fix SJA1000 dlc for RTR packets Kurt Van Dijck
     [not found] ` <20110502145048.GF338-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
2011-05-02 15:15   ` Marc Kleine-Budde
2011-05-05 18:02 ` 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).