Commit 17fb11ae0cb25d050aae298ded291a7d51879649
Committed by
Greg Kroah-Hartman
1 parent
9111e41c16
can: kvaser_usb: Don't send a RESET_CHIP for non-existing channels
commit 5e7e6e0c9b47a45576c38b4a72d67927a5e049f7 upstream. Recent Leaf firmware versions (>= 3.1.557) do not allow to send commands for non-existing channels. If a command is sent for a non-existing channel, the firmware crashes. Reported-by: Christopher Storah <Christopher.Storah@invetech.com.au> Signed-off-by: Olivier Sobrie <olivier@sobrie.be> Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff
drivers/net/can/usb/kvaser_usb.c
... | ... | @@ -1503,6 +1503,10 @@ |
1503 | 1503 | struct kvaser_usb_net_priv *priv; |
1504 | 1504 | int i, err; |
1505 | 1505 | |
1506 | + err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel); | |
1507 | + if (err) | |
1508 | + return err; | |
1509 | + | |
1506 | 1510 | netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); |
1507 | 1511 | if (!netdev) { |
1508 | 1512 | dev_err(&intf->dev, "Cannot alloc candev\n"); |
... | ... | @@ -1606,9 +1610,6 @@ |
1606 | 1610 | init_usb_anchor(&dev->rx_submitted); |
1607 | 1611 | |
1608 | 1612 | usb_set_intfdata(intf, dev); |
1609 | - | |
1610 | - for (i = 0; i < MAX_NET_DEVICES; i++) | |
1611 | - kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, i); | |
1612 | 1613 | |
1613 | 1614 | err = kvaser_usb_get_software_info(dev); |
1614 | 1615 | if (err) { |