Commit 5e7e6e0c authored by Ahmed S. Darwish's avatar Ahmed S. Darwish Committed by Marc Kleine-Budde

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: default avatarChristopher Storah <Christopher.Storah@invetech.com.au>
Signed-off-by: default avatarOlivier Sobrie <olivier@sobrie.be>
Signed-off-by: default avatarAhmed S. Darwish <ahmed.darwish@valeo.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 889b77f7
...@@ -1503,6 +1503,10 @@ static int kvaser_usb_init_one(struct usb_interface *intf, ...@@ -1503,6 +1503,10 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
struct kvaser_usb_net_priv *priv; struct kvaser_usb_net_priv *priv;
int i, err; int i, err;
err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel);
if (err)
return err;
netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS);
if (!netdev) { if (!netdev) {
dev_err(&intf->dev, "Cannot alloc candev\n"); dev_err(&intf->dev, "Cannot alloc candev\n");
...@@ -1607,9 +1611,6 @@ static int kvaser_usb_probe(struct usb_interface *intf, ...@@ -1607,9 +1611,6 @@ static int kvaser_usb_probe(struct usb_interface *intf,
usb_set_intfdata(intf, dev); usb_set_intfdata(intf, dev);
for (i = 0; i < MAX_NET_DEVICES; i++)
kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, i);
err = kvaser_usb_get_software_info(dev); err = kvaser_usb_get_software_info(dev);
if (err) { if (err) {
dev_err(&intf->dev, dev_err(&intf->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment