[USBPORT]

- Simplify some loops in USBPORT_OpenInterface. No logical changes

svn path=/trunk/; revision=75907
This commit is contained in:
Thomas Faber 2017-09-18 12:01:12 +00:00
parent f8f16e6698
commit 67b277f50f

View file

@ -304,17 +304,12 @@ USBPORT_OpenInterface(IN PURB Urb,
RtlZeroMemory(InterfaceHandle, HandleLength);
if (NumEndpoints > 0)
{
PipeHandle = &InterfaceHandle->PipeHandle[0];
for (ix = 0; ix < NumEndpoints; ++ix)
{
PipeHandle = &InterfaceHandle->PipeHandle[ix];
PipeHandle->Flags = PIPE_HANDLE_FLAG_CLOSED;
PipeHandle->Endpoint = NULL;
PipeHandle += 1;
}
}
IsAllocated = TRUE;
@ -335,12 +330,10 @@ USBPORT_OpenInterface(IN PURB Urb,
Descriptor = (PUSB_ENDPOINT_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor +
InterfaceDescriptor->bLength);
if (NumEndpoints)
{
PipeHandle = &InterfaceHandle->PipeHandle[0];
for (ix = 0; ix < NumEndpoints; ++ix)
{
PipeHandle = &InterfaceHandle->PipeHandle[ix];
while (Descriptor->bDescriptorType != USB_ENDPOINT_DESCRIPTOR_TYPE)
{
if (Descriptor->bLength == 0)
@ -380,20 +373,15 @@ USBPORT_OpenInterface(IN PURB Urb,
Descriptor = (PUSB_ENDPOINT_DESCRIPTOR)((ULONG_PTR)Descriptor +
Descriptor->bLength);
PipeHandle += 1;
}
}
if (USBD_SUCCESS(USBDStatus))
{
if (NumEndpoints)
{
PipeInfo = &InterfaceInfo->Pipes[0];
PipeHandle = &InterfaceHandle->PipeHandle[0];
for (ix = 0; ix < NumEndpoints; ++ix)
{
PipeInfo = &InterfaceInfo->Pipes[ix];
PipeHandle = &InterfaceHandle->PipeHandle[ix];
Status = USBPORT_OpenPipe(FdoDevice,
DeviceHandle,
PipeHandle,
@ -403,11 +391,10 @@ USBPORT_OpenInterface(IN PURB Urb,
break;
PipeInfo->PipeHandle = PipeHandle;
PipeHandle += 1;
PipeInfo += 1;
}
if (NumEndpoints)
{
USBPORT_USBDStatusToNtStatus(Urb, USBDStatus);
}
}