OpenCloudOS-Kernel/drivers/net/can/usb/peak_usb
Marc Kleine-Budde 06b23f7fbb can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters
The CAN FD data bittiming constants are provided via netlink only when there
are valid CAN FD constants available in priv->data_bittiming_const.

Due to the indirection of pointer assignments in the peak_usb driver the
priv->data_bittiming_const never becomes NULL - not even for non-FD adapters.

The data_bittiming_const points to zero'ed data which leads to this result
when running 'ip -details link show can0':

35: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0
    can state STOPPED restart-ms 0
	  pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
	  : dtseg1 0..0 dtseg2 0..0 dsjw 1..0 dbrp 0..0 dbrp-inc 0  <== BROKEN!
	  clock 8000000

This patch changes the struct peak_usb_adapter::bittiming_const and struct
peak_usb_adapter::data_bittiming_const to pointers to fix the assignemnt
problems.

Cc: linux-stable <stable@vger.kernel.org> # >= 4.0
Reported-by: Oliver Hartkopp <socketcan@hartkopp.net>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-08-25 08:50:00 +02:00
..
Makefile can: peak_usb: add support for PEAK new CANFD USB adapters 2015-01-28 14:47:06 +01:00
pcan_ucan.h can: peak_usb_fd: add support for ISO / non-ISO mode switching 2015-03-22 18:14:51 +01:00
pcan_usb.c can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters 2015-08-25 08:50:00 +02:00
pcan_usb_core.c can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters 2015-08-25 08:50:00 +02:00
pcan_usb_core.h can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters 2015-08-25 08:50:00 +02:00
pcan_usb_fd.c can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters 2015-08-25 08:50:00 +02:00
pcan_usb_pro.c can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters 2015-08-25 08:50:00 +02:00
pcan_usb_pro.h can: peak_usb: export pcan_usb_pro functions 2015-01-28 14:47:06 +01:00