When the device is disconnected, the dev structure goes away, sotrying to report another error via dev_printk is bound to oops.To avoid that, first check whether the device is still connectedand return quietly if it isn't.