Skip to content

Commit bc65cc4

Browse files
diandersdavem330
authored andcommitted
r8152: Check for unplug in r8153b_ups_en() / r8153c_ups_en()
If the adapter is unplugged while we're looping in r8153b_ups_en() / r8153c_ups_en() we could end up looping for 10 seconds (20 ms * 500 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 dc90ba3 commit bc65cc4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/net/usb/r8152.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3663,6 +3663,8 @@ static void r8153b_ups_en(struct r8152 *tp, bool enable)
36633663
int i;
36643664

36653665
for (i = 0; i < 500; i++) {
3666+
if (test_bit(RTL8152_UNPLUG, &tp->flags))
3667+
return;
36663668
if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
36673669
AUTOLOAD_DONE)
36683670
break;
@@ -3703,6 +3705,8 @@ static void r8153c_ups_en(struct r8152 *tp, bool enable)
37033705
int i;
37043706

37053707
for (i = 0; i < 500; i++) {
3708+
if (test_bit(RTL8152_UNPLUG, &tp->flags))
3709+
return;
37063710
if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
37073711
AUTOLOAD_DONE)
37083712
break;

0 commit comments

Comments
 (0)