When booting on a Thinkpad T440p with an empty SD card slot, the rtsx driver starts up an instance of the mmc driver. This calls mmc_attach(), which establishes an intrhook to later run mmc_delayed_attach(); mmc_delayed_attach() is responsible for disestablishing the intrhook. Then, since there's no card in the SD card slot, rtsx immediately deletes the mmc driver instance. This causes mmc_detach() to run, which cleans everything up. However, this means that mmc_delayed_attach() doesn't get the chance to properly disestablish the intrhook, leading to a kernel panic.
To fix this, this change adds a call to config_intrhook_drain(), which does nothing if the intrhook is running or has already ran (the SD card was plugged in), and disestablishes the hook if it hasn't ran yet (the SD card was not plugged in).