diff options
author | Ahmed S. Darwish <ahmed.darwish@valeo.com> | 2015-01-05 12:57:13 -0500 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-01-15 10:58:01 -0500 |
commit | 5e7e6e0c9b47a45576c38b4a72d67927a5e049f7 (patch) | |
tree | 9b9b457b43a2ab90bdbc5f18e8c841755c9ce05e | |
parent | 889b77f7fd2bcc922493d73a4c51d8a851505815 (diff) |
can: kvaser_usb: Don't send a RESET_CHIP for non-existing channels
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>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r-- | drivers/net/can/usb/kvaser_usb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 9accc8272c27..cc7bfc0c0a71 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
@@ -1503,6 +1503,10 @@ static int kvaser_usb_init_one(struct usb_interface *intf, | |||
1503 | struct kvaser_usb_net_priv *priv; | 1503 | struct kvaser_usb_net_priv *priv; |
1504 | int i, err; | 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 | netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); | 1510 | netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); |
1507 | if (!netdev) { | 1511 | if (!netdev) { |
1508 | dev_err(&intf->dev, "Cannot alloc candev\n"); | 1512 | dev_err(&intf->dev, "Cannot alloc candev\n"); |
@@ -1607,9 +1611,6 @@ static int kvaser_usb_probe(struct usb_interface *intf, | |||
1607 | 1611 | ||
1608 | usb_set_intfdata(intf, dev); | 1612 | usb_set_intfdata(intf, dev); |
1609 | 1613 | ||
1610 | for (i = 0; i < MAX_NET_DEVICES; i++) | ||
1611 | kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, i); | ||
1612 | |||
1613 | err = kvaser_usb_get_software_info(dev); | 1614 | err = kvaser_usb_get_software_info(dev); |
1614 | if (err) { | 1615 | if (err) { |
1615 | dev_err(&intf->dev, | 1616 | dev_err(&intf->dev, |