[ros-diffs] [fireball] 47167: - Revert 47139 by cgutman: Don't try to be smarter than usbdriver's author. He especially put registering HCD interface before so that any error handling function would work correctly and free up allocated resources. Fixes one crash in VMWare. A proper solution for the problem which 47139 tried to "fix" will be committed next.

fireball at svn.reactos.org fireball at svn.reactos.org
Wed May 12 11:34:36 CEST 2010


Author: fireball
Date: Wed May 12 11:34:36 2010
New Revision: 47167

URL: http://svn.reactos.org/svn/reactos?rev=47167&view=rev
Log:
- Revert 47139 by cgutman: Don't try to be smarter than usbdriver's author. He especially put registering HCD interface before so that any error handling function would work correctly and free up allocated resources. Fixes one crash in VMWare. A proper solution for the problem which 47139 tried to "fix" will be committed next.

Modified:
    trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c
    trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c

Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c?rev=47167&r1=47166&r2=47167&view=diff
==============================================================================
--- trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c [iso-8859-1] Wed May 12 11:34:36 2010
@@ -3530,7 +3530,6 @@
     CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd;
     PCI_SLOT_NUMBER slot_num;
     NTSTATUS status;
-    UCHAR hcd_id;
 
 
     pdev = ehci_create_device(drvr_obj, dev_mgr);
@@ -3697,13 +3696,6 @@
         return NULL;
     }
 
-    //register with dev_mgr
-    ehci_init_hcd_interface(pdev_ext->ehci);
-    hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ehci->hcd_interf);
-
-    pdev_ext->ehci->hcd_interf.hcd_set_id(&pdev_ext->ehci->hcd_interf, hcd_id);
-    pdev_ext->ehci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ehci->hcd_interf, dev_mgr);
-
     return pdev;
 }
 
@@ -3719,6 +3711,7 @@
 
     STRING string, another_string;
     CHAR str_dev_name[64], str_symb_name[64];
+    UCHAR hcd_id;
 
     if (drvr_obj == NULL)
         return NULL;
@@ -3767,6 +3760,13 @@
 
     RtlFreeUnicodeString(&dev_name);
     RtlFreeUnicodeString(&symb_name);
+
+    //register with dev_mgr though it is not initilized
+    ehci_init_hcd_interface(pdev_ext->ehci);
+    hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ehci->hcd_interf);
+
+    pdev_ext->ehci->hcd_interf.hcd_set_id(&pdev_ext->ehci->hcd_interf, hcd_id);
+    pdev_ext->ehci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ehci->hcd_interf, dev_mgr);
 
     return pdev;
 

Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c?rev=47167&r1=47166&r2=47167&view=diff
==============================================================================
--- trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c [iso-8859-1] Wed May 12 11:34:36 2010
@@ -67,7 +67,6 @@
 
 #define release_adapter( padapTER ) HalPutDmaAdapter(padapTER)
 
-
 #define get_int_idx( _urb, _idx ) \
 {\
 	UCHAR interVAL;\
@@ -406,6 +405,7 @@
 
     STRING string, another_string;
     CHAR str_dev_name[64], str_symb_name[64];
+    UCHAR hcd_id;
 
     if (drvr_obj == NULL)
         return NULL;
@@ -455,6 +455,12 @@
     RtlFreeUnicodeString(&dev_name);
     RtlFreeUnicodeString(&symb_name);
 
+    //register with dev_mgr though it is not initilized
+    uhci_init_hcd_interface(pdev_ext->uhci);
+    hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->uhci->hcd_interf);
+
+    pdev_ext->uhci->hcd_interf.hcd_set_id(&pdev_ext->uhci->hcd_interf, hcd_id);
+    pdev_ext->uhci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->uhci->hcd_interf, dev_mgr);
     return pdev;
 }
 
@@ -681,7 +687,6 @@
     CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd;
     PCI_SLOT_NUMBER slot_num;
     NTSTATUS status;
-    UCHAR hcd_id;
 
 
     pdev = uhci_create_device(drvr_obj, dev_mgr);
@@ -846,13 +851,6 @@
         uhci_release(pdev);
         return NULL;
     }
-
-    //register with dev_mgr
-    uhci_init_hcd_interface(pdev_ext->uhci);
-    hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->uhci->hcd_interf);
-
-    pdev_ext->uhci->hcd_interf.hcd_set_id(&pdev_ext->uhci->hcd_interf, hcd_id);
-    pdev_ext->uhci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->uhci->hcd_interf, dev_mgr);
 
     return pdev;
 }




More information about the Ros-diffs mailing list