summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/asix_devices.c
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2016-08-29 15:32:16 +0200
committerDavid S. Miller <davem@davemloft.net>2016-09-01 06:07:05 +0200
commit8a46f665833a2085e402bd0827be380f161f09ef (patch)
treed15ae39e7a98704fad123b6be04674114fc41592 /drivers/net/usb/asix_devices.c
parentnet: asix: Add in_pm parameter (diff)
downloadlinux-8a46f665833a2085e402bd0827be380f161f09ef.tar.xz
linux-8a46f665833a2085e402bd0827be380f161f09ef.zip
net: asix: Avoid looping when the device is disconnected
From: Vincent Palatin <vpalatin@chromium.org> Check the answers from the USB stack and avoid re-sending multiple times the request if the device has disappeared. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Robert Foss <robert.foss@collabora.com> Tested-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/asix_devices.c')
-rw-r--r--drivers/net/usb/asix_devices.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index aaa42909d932..ebeb73014fdf 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -79,6 +79,8 @@ static u32 asix_get_phyid(struct usbnet *dev)
/* Poll for the rare case the FW or phy isn't ready yet. */
for (i = 0; i < 100; i++) {
phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1);
+ if (phy_reg < 0)
+ return 0;
if (phy_reg != 0 && phy_reg != 0xFFFF)
break;
mdelay(1);