From 0aad82d600b41ba12d9f20e2947e233ccd9c6352 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Tue, 1 Dec 2015 15:49:42 -0800 Subject: [PATCH] sys: FspDeviceRelease: bug fix --- src/sys/device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sys/device.c b/src/sys/device.c index 22f9b8cd..f90a91fa 100644 --- a/src/sys/device.c +++ b/src/sys/device.c @@ -224,18 +224,20 @@ VOID FspDeviceRelease(PDEVICE_OBJECT DeviceObject) { // !PAGED_CODE(); - BOOLEAN Result; + BOOLEAN Delete = FALSE; FSP_DEVICE_EXTENSION *DeviceExtension; KIRQL Irql; DeviceExtension = FspDeviceExtension(DeviceObject); KeAcquireSpinLock(&DeviceExtension->SpinLock, &Irql); if (0 != DeviceExtension->RefCount) + { DeviceExtension->RefCount--; - Result = 0 != DeviceExtension->RefCount; + Delete = 0 == DeviceExtension->RefCount; + } KeReleaseSpinLock(&DeviceExtension->SpinLock, Irql); - if (!Result) + if (Delete) FspDeviceDelete(DeviceObject); }