From 8a46f665833a2085e402bd0827be380f161f09ef Mon Sep 17 00:00:00 2001 From: Robert Foss Date: Mon, 29 Aug 2016 09:32:16 -0400 Subject: net: asix: Avoid looping when the device is disconnected From: Vincent Palatin 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 Signed-off-by: Robert Foss Tested-by: Robert Foss Signed-off-by: David S. Miller --- drivers/net/usb/asix_devices.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/net/usb/asix_devices.c') 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); -- cgit v1.2.3