--- x/net/nfc/core.c +++ a/net/nfc/core.c @@ -1163,13 +1163,16 @@ void nfc_unregister_device(struct nfc_de "was removed\n", dev_name(&dev->dev)); device_lock(&dev->dev); + dev->shutting_down = true; if (dev->rfkill) { - rfkill_unregister(dev->rfkill); - rfkill_destroy(dev->rfkill); + struct rfkill *rfkill = dev->rfkill; dev->rfkill = NULL; - } - dev->shutting_down = true; - device_unlock(&dev->dev); + + device_unlock(&dev->dev); + rfkill_unregister(rfkill); + rfkill_destroy(rfkill); + } else + device_unlock(&dev->dev); if (dev->ops->check_presence) { del_timer_sync(&dev->check_pres_timer);