[ros-diffs] [cgutman] 56124: [VIDEOPRT] - Don't add legacy resources twice in VideoPortGetAccessRanges - Fixes Cirrus driver initialization

cgutman at svn.reactos.org cgutman at svn.reactos.org
Mon Mar 12 01:38:23 UTC 2012


Author: cgutman
Date: Mon Mar 12 01:38:21 2012
New Revision: 56124

URL: http://svn.reactos.org/svn/reactos?rev=56124&view=rev
Log:
[VIDEOPRT]
- Don't add legacy resources twice in VideoPortGetAccessRanges
- Fixes Cirrus driver initialization

Modified:
    trunk/reactos/drivers/video/videoprt/resource.c

Modified: trunk/reactos/drivers/video/videoprt/resource.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/videoprt/resource.c?rev=56124&r1=56123&r2=56124&view=diff
==============================================================================
--- trunk/reactos/drivers/video/videoprt/resource.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/video/videoprt/resource.c [iso-8859-1] Mon Mar 12 01:38:21 2012
@@ -567,7 +567,7 @@
     PCI_COMMON_CONFIG Config;
     PCM_RESOURCE_LIST AllocatedResources;
     NTSTATUS Status;
-    UINT AssignedCount;
+    UINT AssignedCount = 0;
     CM_FULL_RESOURCE_DESCRIPTOR *FullList;
     CM_PARTIAL_RESOURCE_DESCRIPTOR *Descriptor;
     PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
@@ -682,6 +682,21 @@
             }
             DeviceExtension->AllocatedResources = AllocatedResources;
             DeviceExtension->SystemIoSlotNumber = PciSlotNumber.u.AsULONG;
+
+            /* Add legacy resources to the resources from HAL */
+            Status = IntVideoPortGetLegacyResources(DriverExtension, DeviceExtension,
+                                                    &LegacyAccessRanges, &LegacyAccessRangeCount);
+            if (!NT_SUCCESS(Status))
+                return ERROR_DEV_NOT_EXIST;
+
+            if (NumAccessRanges < LegacyAccessRangeCount)
+            {
+                ERR_(VIDEOPRT, "Too many legacy access ranges found\n");
+                return ERROR_NOT_ENOUGH_MEMORY;
+            }
+
+            RtlCopyMemory(AccessRanges, LegacyAccessRanges, LegacyAccessRangeCount * sizeof(VIDEO_ACCESS_RANGE));
+            AssignedCount = LegacyAccessRangeCount;
         }
     }
     else
@@ -725,18 +740,7 @@
     
     /* Return the slot number if the caller wants it */
     if (Slot != NULL) *Slot = DeviceExtension->SystemIoBusNumber;
-    
-    Status = IntVideoPortGetLegacyResources(DriverExtension, DeviceExtension,
-                                            &LegacyAccessRanges, &LegacyAccessRangeCount);
-    if (!NT_SUCCESS(Status))
-        return ERROR_DEV_NOT_EXIST;
-    if (NumAccessRanges < LegacyAccessRangeCount)
-    {
-        ERR_(VIDEOPRT, "Too many legacy access ranges found\n");
-        return ERROR_NOT_ENOUGH_MEMORY;
-    }
-    RtlCopyMemory(AccessRanges, LegacyAccessRanges, LegacyAccessRangeCount * sizeof(VIDEO_ACCESS_RANGE));
-    AssignedCount = LegacyAccessRangeCount;
+
     for (FullList = AllocatedResources->List;
          FullList < AllocatedResources->List + AllocatedResources->Count;
          FullList++)




More information about the Ros-diffs mailing list