Skip to content

Commit dc90ba3

Browse files
diandersdavem330
authored andcommitted
r8152: Check for unplug in rtl_phy_patch_request()
If the adapter is unplugged while we're looping in rtl_phy_patch_request() we could end up looping for 10 seconds (2 ms * 5000 loops). Add code similar to what's done in other places in the driver to check for unplug and bail. Signed-off-by: Douglas Anderson <[email protected]> Reviewed-by: Grant Grundler <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b8d3502 commit dc90ba3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/usb/r8152.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4046,6 +4046,9 @@ static int rtl_phy_patch_request(struct r8152 *tp, bool request, bool wait)
40464046
for (i = 0; wait && i < 5000; i++) {
40474047
u32 ocp_data;
40484048

4049+
if (test_bit(RTL8152_UNPLUG, &tp->flags))
4050+
break;
4051+
40494052
usleep_range(1000, 2000);
40504053
ocp_data = ocp_reg_read(tp, OCP_PHY_PATCH_STAT);
40514054
if ((ocp_data & PATCH_READY) ^ check)

0 commit comments

Comments
 (0)