• Marc Kleine-Budde's avatar
    can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters · 06b23f7f
    Marc Kleine-Budde authored
    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: default avatarOliver Hartkopp <socketcan@hartkopp.net>
    Tested-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
    Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
    06b23f7f
pcan_usb_pro.c 26.5 KB