summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@bitwise.fi>2022-10-10 18:08:29 +0300
committerMarc Kleine-Budde <mkl@pengutronix.de>2022-10-11 09:50:44 +0300
commit0be1a655fe68c8e6dcadbcbddb69cf2fb29881f5 (patch)
tree1b648f2929c7bcd472d5840b9370ad24e6862c8c /drivers/net
parent455561fb618fde40558776b5b8435f9420f335db (diff)
downloadlinux-0be1a655fe68c8e6dcadbcbddb69cf2fb29881f5.tar.xz
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. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson <extja@kvaser.com> Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi> Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Link: https://lore.kernel.org/all/20221010150829.199676-5-extja@kvaser.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c2
1 files changed, 2 insertions, 0 deletions
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 59c220ef3049..50f2ac8319ff 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
@@ -1431,6 +1431,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;
break;
default:
return -EOPNOTSUPP;