* [PATCH] ax88179_178a: don't send commands to detached device
@ 2014-05-14 15:02 Emil Goode
2014-05-14 15:12 ` Alan Stern
0 siblings, 1 reply; 2+ messages in thread
From: Emil Goode @ 2014-05-14 15:02 UTC (permalink / raw)
To: David S. Miller, Freddy Xin, Eric Dumazet, David Chang,
Greg Kroah-Hartman, Ming Lei, Gerry Demaret, Mathias Nyman
Cc: linux-usb, netdev, linux-kernel, Emil Goode
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ax88179_178a: don't send commands to detached device
2014-05-14 15:02 [PATCH] ax88179_178a: don't send commands to detached device Emil Goode
@ 2014-05-14 15:12 ` Alan Stern
0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2014-05-14 15:12 UTC (permalink / raw)
To: Emil Goode
Cc: David S. Miller, Freddy Xin, Eric Dumazet, David Chang,
Greg Kroah-Hartman, Ming Lei, Gerry Demaret, Mathias Nyman,
linux-usb, netdev, linux-kernel
On Wed, 14 May 2014, Emil Goode wrote:
> 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
Most driver don't bother to do this. A few error messages in the log
when a device gets unplugged are harmless. Besides, this won't help
with errors that occur between the time the device is unplugged and the
time when the unbind callback runs.
Alan Stern
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-14 15:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14 15:02 [PATCH] ax88179_178a: don't send commands to detached device Emil Goode
2014-05-14 15:12 ` Alan Stern
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).