https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ab88f25048d3b34ae7039…
commit ab88f25048d3b34ae7039581368b2ac2e166376e
Author: Vadim Galyant <vgal(a)rambler.ru>
AuthorDate: Thu Jan 11 01:53:45 2018 +0900
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sun Jan 21 19:35:58 2018 +0100
[USBPORT] Check Period instead Factor.
---
drivers/usb/usbport/endpoint.c | 7 ++++---
drivers/usb/usbport/usb2.c | 4 ++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/usbport/endpoint.c b/drivers/usb/usbport/endpoint.c
index 18293a763d..2e9881bff2 100644
--- a/drivers/usb/usbport/endpoint.c
+++ b/drivers/usb/usbport/endpoint.c
@@ -96,9 +96,10 @@ USBPORT_AllocateBandwidth(IN PDEVICE_OBJECT FdoDevice,
TotalBusBandwidth = FdoExtension->TotalBusBandwidth;
EndpointBandwidth = EndpointProperties->UsbBandwidth;
+
Period = EndpointProperties->Period;
+ ASSERT(Period != 0);
Factor = USB2_FRAMES / Period;
- ASSERT(Factor);
for (Offset = 0; Offset < Period; Offset++)
{
@@ -197,9 +198,9 @@ USBPORT_FreeBandwidth(IN PDEVICE_OBJECT FdoDevice,
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--)
{
diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c
index a382d519bb..6259cf487e 100644
--- a/drivers/usb/usbport/usb2.c
+++ b/drivers/usb/usbport/usb2.c
@@ -2107,6 +2107,8 @@ USBPORT_FreeBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,
FdoExtension = FdoDevice->DeviceExtension;
Period = Endpoint->EndpointProperties.Period;
+ ASSERT(Period != 0);
+
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;
- ASSERT(Factor);
-
n = ScheduleOffset * Factor;
TtExtension = Endpoint->TtExtension;