[lkml]   [2022]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH 07/12] can: kvaser_usb_leaf: Fix CAN state after restart
    can_restart() expects CMD_START_CHIP to set the error state to
    ERROR_ACTIVE as it calls netif_carrier_on() immediately afterwards.

    Otherwise the user may immediately trigger restart again and hit a
    BUG_ON() in can_restart().

    Fix kvaser_usb_leaf set_mode(CMD_START_CHIP) to set the expected state.

    Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices")
    Signed-off-by: Anssi Hannula <>
    drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
    index 2d30a662edb5..5f27c00179c1 100644
    --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
    +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
    @@ -1411,6 +1411,8 @@ static int kvaser_usb_leaf_set_mode(struct net_device *netdev,
    err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP);
    if (err)
    return err;
    + priv->can.state = CAN_STATE_ERROR_ACTIVE;
    return -EOPNOTSUPP;
     \ /
      Last update: 2022-05-16 15:55    [W:6.245 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site