Loading...
iokit/Kernel/IOInterruptController.cpp xnu-201.19.3 xnu-201
--- xnu/xnu-201.19.3/iokit/Kernel/IOInterruptController.cpp
+++ xnu/xnu-201/iokit/Kernel/IOInterruptController.cpp
@@ -556,26 +556,23 @@
   long              vectorNumber;
   IOInterruptVector *vector;
   OSData            *vectorData;
-  IOInterruptState  interruptState;
-  
-  interruptSources = nub->_interruptSources;
-  vectorData = interruptSources[source].vectorData;
-  vectorNumber = *(long *)vectorData->getBytesNoCopy();
-  vector = &vectors[vectorNumber];
-  
-  interruptState = IOSimpleLockLockDisableInterrupt(controllerLock);
-  if (!vector->interruptDisabledSoft) {
+  IOInterruptState  interruptState;;
+  
+  interruptSources = nub->_interruptSources;
+  vectorData = interruptSources[source].vectorData;
+  vectorNumber = *(long *)vectorData->getBytesNoCopy();
+  vector = &vectors[vectorNumber];
+  
+  if (vector->interruptDisabledSoft) {
+    interruptState = IOSimpleLockLockDisableInterrupt(controllerLock);
+    vector->interruptDisabledSoft = 0;
+    vectorsEnabled++;
     IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
-    return kIOReturnSuccess;
-  }
-  
-  vector->interruptDisabledSoft = 0;
-  vectorsEnabled++;
-  IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
-  
-  if (controllerDisabled && (vectorsEnabled == vectorsRegistered)) {
-    controllerDisabled = 0;
-    provider->enableInterrupt(0);
+    
+    if (controllerDisabled && (vectorsEnabled == vectorsRegistered)) {
+      controllerDisabled = 0;
+      provider->enableInterrupt(0);
+    }
   }
   
   return kIOReturnSuccess;
@@ -588,23 +585,23 @@
   long              vectorNumber;
   IOInterruptVector *vector;
   OSData            *vectorData;
-  IOInterruptState  interruptState;
-  
-  interruptSources = nub->_interruptSources;
-  vectorData = interruptSources[source].vectorData;
-  vectorNumber = *(long *)vectorData->getBytesNoCopy();
-  vector = &vectors[vectorNumber];
-  
-  interruptState = IOSimpleLockLockDisableInterrupt(controllerLock); 
+  IOInterruptState  interruptState;;
+  
+  interruptSources = nub->_interruptSources;
+  vectorData = interruptSources[source].vectorData;
+  vectorNumber = *(long *)vectorData->getBytesNoCopy();
+  vector = &vectors[vectorNumber];
+  
   if (!vector->interruptDisabledSoft) {
+    interruptState = IOSimpleLockLockDisableInterrupt(controllerLock); 
     vector->interruptDisabledSoft = 1;
 #if __ppc__
     sync();
     isync();
 #endif
     vectorsEnabled--;
-  }
-  IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
+    IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
+  }
   
   if (!getPlatform()->atInterruptLevel()) {
     while (vector->interruptActive);