[USBPORT] Check Period instead Factor.

This commit is contained in:
Vadim Galyant 2018-01-11 01:53:45 +09:00 committed by Amine Khaldi
parent 954cc021da
commit ab88f25048
2 changed files with 6 additions and 5 deletions

View file

@ -96,9 +96,10 @@ USBPORT_AllocateBandwidth(IN PDEVICE_OBJECT FdoDevice,
TotalBusBandwidth = FdoExtension->TotalBusBandwidth; TotalBusBandwidth = FdoExtension->TotalBusBandwidth;
EndpointBandwidth = EndpointProperties->UsbBandwidth; 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; Offset = Endpoint->EndpointProperties.ScheduleOffset;
EndpointBandwidth = Endpoint->EndpointProperties.UsbBandwidth; 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--)
{ {

View file

@ -2107,6 +2107,8 @@ USBPORT_FreeBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,
FdoExtension = FdoDevice->DeviceExtension; FdoExtension = FdoDevice->DeviceExtension;
Period = Endpoint->EndpointProperties.Period; Period = Endpoint->EndpointProperties.Period;
ASSERT(Period != 0);
ScheduleOffset = Endpoint->EndpointProperties.ScheduleOffset; ScheduleOffset = Endpoint->EndpointProperties.ScheduleOffset;
EndpointBandwidth = Endpoint->EndpointProperties.UsbBandwidth; EndpointBandwidth = Endpoint->EndpointProperties.UsbBandwidth;
@ -2134,8 +2136,6 @@ USBPORT_FreeBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,
RtlZeroMemory(Rebalance, sizeof(USB2_REBALANCE)); RtlZeroMemory(Rebalance, sizeof(USB2_REBALANCE));
Factor = USB2_FRAMES / Period; Factor = USB2_FRAMES / Period;
ASSERT(Factor);
n = ScheduleOffset * Factor; n = ScheduleOffset * Factor;
TtExtension = Endpoint->TtExtension; TtExtension = Endpoint->TtExtension;