[USBPORT] Check Period instead Factor.
authorVadim Galyant <vgal@rambler.ru>
Wed, 10 Jan 2018 16:53:45 +0000 (01:53 +0900)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Jan 2018 18:35:58 +0000 (19:35 +0100)
drivers/usb/usbport/endpoint.c
drivers/usb/usbport/usb2.c

index 18293a7..2e9881b 100644 (file)
@@ -96,9 +96,10 @@ USBPORT_AllocateBandwidth(IN PDEVICE_OBJECT FdoDevice,
 
     TotalBusBandwidth = FdoExtension->TotalBusBandwidth;
     EndpointBandwidth = EndpointProperties->UsbBandwidth;
 
     TotalBusBandwidth = FdoExtension->TotalBusBandwidth;
     EndpointBandwidth = EndpointProperties->UsbBandwidth;
+
     Period = EndpointProperties->Period;
     Period = EndpointProperties->Period;
+    ASSERT(Period != 0);
     Factor = USB2_FRAMES / Period;
     Factor = USB2_FRAMES / Period;
-    ASSERT(Factor);
 
     for (Offset = 0; Offset < Period; Offset++)
     {
 
     for (Offset = 0; Offset < Period; Offset++)
     {
@@ -197,9 +198,9 @@ USBPORT_FreeBandwidth(IN PDEVICE_OBJECT FdoDevice,
 
     Offset = Endpoint->EndpointProperties.ScheduleOffset;
     EndpointBandwidth = Endpoint->EndpointProperties.UsbBandwidth;
 
     Offset = Endpoint->EndpointProperties.ScheduleOffset;
     EndpointBandwidth = Endpoint->EndpointProperties.UsbBandwidth;
-    Period = Endpoint->EndpointProperties.Period;
 
 
-    ASSERT(USB2_FRAMES / Period);
+    Period = Endpoint->EndpointProperties.Period;
+    ASSERT(Period != 0);
 
     for (Factor = USB2_FRAMES / Period; Factor; Factor--)
     {
 
     for (Factor = USB2_FRAMES / Period; Factor; Factor--)
     {
index a382d51..6259cf4 100644 (file)
@@ -2107,6 +2107,8 @@ USBPORT_FreeBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,
     FdoExtension = FdoDevice->DeviceExtension;
 
     Period = Endpoint->EndpointProperties.Period;
     FdoExtension = FdoDevice->DeviceExtension;
 
     Period = Endpoint->EndpointProperties.Period;
+    ASSERT(Period != 0);
+
     ScheduleOffset = Endpoint->EndpointProperties.ScheduleOffset;
     EndpointBandwidth = Endpoint->EndpointProperties.UsbBandwidth;
 
     ScheduleOffset = Endpoint->EndpointProperties.ScheduleOffset;
     EndpointBandwidth = Endpoint->EndpointProperties.UsbBandwidth;
 
@@ -2134,8 +2136,6 @@ USBPORT_FreeBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,
     RtlZeroMemory(Rebalance, sizeof(USB2_REBALANCE));
 
     Factor = USB2_FRAMES / Period;
     RtlZeroMemory(Rebalance, sizeof(USB2_REBALANCE));
 
     Factor = USB2_FRAMES / Period;
-    ASSERT(Factor);
-
     n = ScheduleOffset * Factor;
 
     TtExtension = Endpoint->TtExtension;
     n = ScheduleOffset * Factor;
 
     TtExtension = Endpoint->TtExtension;