Commit 9a15b57e authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Kalle Valo

mt7601u: don't cleanup device second time after .resume()

Make sure .disconnect() doesn't cleanup the device if
.resume() failed.  This may happen when device is removed
during suspend.
Signed-off-by: default avatarJakub Kicinski <kubakici@wp.pl>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 2af6d21f
......@@ -427,6 +427,9 @@ int mt7601u_init_hardware(struct mt7601u_dev *dev)
void mt7601u_cleanup(struct mt7601u_dev *dev)
{
if (!test_and_clear_bit(MT7601U_STATE_INITIALIZED, &dev->state))
return;
mt7601u_stop_hardware(dev);
mt7601u_dma_cleanup(dev);
mt7601u_mcu_cmd_deinit(dev);
......
......@@ -338,8 +338,15 @@ static int mt7601u_suspend(struct usb_interface *usb_intf, pm_message_t state)
static int mt7601u_resume(struct usb_interface *usb_intf)
{
struct mt7601u_dev *dev = usb_get_intfdata(usb_intf);
int ret;
ret = mt7601u_init_hardware(dev);
if (ret)
return ret;
set_bit(MT7601U_STATE_INITIALIZED, &dev->state);
return mt7601u_init_hardware(dev);
return 0;
}
MODULE_DEVICE_TABLE(usb, mt7601u_device_table);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment