From: Emil Goode <emilgoode@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
Freddy Xin <freddy@asix.com.tw>,
Eric Dumazet <edumazet@google.com>, David Chang <dchang@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ming Lei <ming.lei@canonical.com>,
Gerry Demaret <gerry@tigron.be>,
Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Emil Goode <emilgoode@gmail.com>
Subject: [PATCH] ax88179_178a: don't send commands to detached device
Date: Wed, 14 May 2014 17:02:10 +0200 [thread overview]
Message-ID: <1400079730-22424-1-git-send-email-emilgoode@gmail.com> (raw)
The .stop and .unbind callbacks of struct driver_info are
called even after a DETACH hot-plug event. In the case of
the ax88179_178a minidriver we need to make sure we are not
trying to send commands to a device that has been detached.
This leads to failure messages like below.
ax88179_178a 1-1.3:1.0 (unregistered net_device):
Failed to write reg index 0x0001: -19
Signed-off-by: Emil Goode <emilgoode@gmail.com>
---
drivers/net/usb/ax88179_178a.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 054e59c..fe20ca8 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1074,6 +1074,9 @@ static void ax88179_unbind(struct usbnet *dev, struct usb_interface *intf)
{
u16 tmp16;
+ if (dev->udev->state == USB_STATE_NOTATTACHED)
+ return;
+
/* Configure RX control register => stop operation */
tmp16 = AX_RX_CTL_STOP;
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16);
@@ -1352,6 +1355,9 @@ static int ax88179_stop(struct usbnet *dev)
{
u16 tmp16;
+ if (dev->udev->state == USB_STATE_NOTATTACHED)
+ return 0;
+
ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
2, 2, &tmp16);
tmp16 &= ~AX_MEDIUM_RECEIVE_EN;
--
1.7.10.4
next reply other threads:[~2014-05-14 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 15:02 Emil Goode [this message]
2014-05-14 15:12 ` [PATCH] ax88179_178a: don't send commands to detached device Alan Stern
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=1400079730-22424-1-git-send-email-emilgoode@gmail.com \
--to=emilgoode@gmail.com \
--cc=davem@davemloft.net \
--cc=dchang@suse.com \
--cc=edumazet@google.com \
--cc=freddy@asix.com.tw \
--cc=gerry@tigron.be \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=ming.lei@canonical.com \
--cc=netdev@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