Device cleanup called before DeviceEntry

Hi,

I am using one of the samples from DDK (general\event). I see that the
device CleanUp is called before DeviceEntry call and the system reboots.

While debugging I observed that the EntryList QueueHead in the
DeviceExtension is not empty and hence thisEntry->Flink fails causing BSOD.

What could be the reason for this?

Thanks in advance!