- Fix a broken check that resulted in freeing the same device object twice
- Enable the IoDetachDevice call in usbstor now that the kernel bug is fixed
svn path=/branches/usb-bringup-trunk/; revision=55086
Status = IoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
/* Detach from the device stack */
- /* IoDetachDevice(DeviceExtension->LowerDeviceObject); */ //This crashes for some reason during unload
+ IoDetachDevice(DeviceExtension->LowerDeviceObject);
/* Delete the device object */
IoDeleteDevice(DeviceObject);
/*
* Check if we have an attached device and fail if we're attached
- * and still have a reference count.
+ * or still have a reference count.
*/
AttachedDeviceObject = DeviceObject->AttachedDevice;
- if ((AttachedDeviceObject) && (DeviceObject->ReferenceCount)) return;
+ if ((AttachedDeviceObject) || (DeviceObject->ReferenceCount)) return;
/* Check if we have a Security Descriptor */
if (DeviceObject->SecurityDescriptor)