netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, linux-can@vger.kernel.org,
	kernel@pengutronix.de,
	"Ahmed S. Darwish" <ahmed.darwish@valeo.com>,
	Olivier Sobrie <olivier@sobrie.be>,
	linux-stable <stable@vger.kernel.org>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 7/8] can: kvaser_usb: Don't send a RESET_CHIP for non-existing channels
Date: Thu, 15 Jan 2015 17:11:22 +0100	[thread overview]
Message-ID: <1421338283-12417-8-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1421338283-12417-1-git-send-email-mkl@pengutronix.de>

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

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>
---
 drivers/net/can/usb/kvaser_usb.c | 7 ++++---
 1 file 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,
 	struct kvaser_usb_net_priv *priv;
 	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);
 	if (!netdev) {
 		dev_err(&intf->dev, "Cannot alloc candev\n");
@@ -1607,9 +1611,6 @@ static int kvaser_usb_probe(struct usb_interface *intf,
 
 	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);
 	if (err) {
 		dev_err(&intf->dev,
-- 
2.1.4

  parent reply	other threads:[~2015-01-15 16:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 16:11 pull-request: can 2015-01-15 Marc Kleine-Budde
2015-01-15 16:11 ` [PATCH 1/8] MAINTAINERS: update linux-can git repositories Marc Kleine-Budde
2015-01-15 16:11 ` [PATCH 2/8] can: dev: fix crtlmode_supported check Marc Kleine-Budde
2015-01-15 16:11 ` [PATCH 3/8] can: m_can: tag current CAN FD controllers as non-ISO Marc Kleine-Budde
2015-01-15 16:11 ` [PATCH 4/8] can: c_can: use regmap_update_bits() to modify RAMINIT register Marc Kleine-Budde
2015-01-15 16:11 ` [PATCH 5/8] can: kvaser_usb: Don't free packets when tight on URBs Marc Kleine-Budde
2015-01-15 16:11 ` [PATCH 6/8] can: kvaser_usb: Reset all URB tx contexts upon channel close Marc Kleine-Budde
2015-01-15 16:11 ` Marc Kleine-Budde [this message]
2015-01-15 16:11 ` [PATCH 8/8] can: kvaser_usb: Don't dereference skb after a netif_rx() Marc Kleine-Budde
2015-01-16  0:39 ` pull-request: can 2015-01-15 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421338283-12417-8-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=ahmed.darwish@valeo.com \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olivier@sobrie.be \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).