Skip to content

Commit 3d55f44

Browse files
hayesorzdavem330
authored andcommitted
r8152: fix the submission of the interrupt transfer
The submission of the interrupt transfer should be done after setting the bit of WORK_ENABLE, otherwise the callback function would have the opportunity to be returned directly. Clear the bit of WORK_ENABLE before killing the interrupt transfer. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 656493d commit 3d55f44

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/net/usb/r8152.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,22 +2273,21 @@ static int rtl8152_open(struct net_device *netdev)
22732273
struct r8152 *tp = netdev_priv(netdev);
22742274
int res = 0;
22752275

2276+
rtl8152_set_speed(tp, AUTONEG_ENABLE,
2277+
tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
2278+
DUPLEX_FULL);
2279+
tp->speed = 0;
2280+
netif_carrier_off(netdev);
2281+
netif_start_queue(netdev);
2282+
set_bit(WORK_ENABLE, &tp->flags);
22762283
res = usb_submit_urb(tp->intr_urb, GFP_KERNEL);
22772284
if (res) {
22782285
if (res == -ENODEV)
22792286
netif_device_detach(tp->netdev);
22802287
netif_warn(tp, ifup, netdev, "intr_urb submit failed: %d\n",
22812288
res);
2282-
return res;
22832289
}
22842290

2285-
rtl8152_set_speed(tp, AUTONEG_ENABLE,
2286-
tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
2287-
DUPLEX_FULL);
2288-
tp->speed = 0;
2289-
netif_carrier_off(netdev);
2290-
netif_start_queue(netdev);
2291-
set_bit(WORK_ENABLE, &tp->flags);
22922291

22932292
return res;
22942293
}
@@ -2298,8 +2297,8 @@ static int rtl8152_close(struct net_device *netdev)
22982297
struct r8152 *tp = netdev_priv(netdev);
22992298
int res = 0;
23002299

2301-
usb_kill_urb(tp->intr_urb);
23022300
clear_bit(WORK_ENABLE, &tp->flags);
2301+
usb_kill_urb(tp->intr_urb);
23032302
cancel_delayed_work_sync(&tp->schedule);
23042303
netif_stop_queue(netdev);
23052304
tasklet_disable(&tp->tl);

0 commit comments

Comments
 (0)