Ep = Setting->Endpoints[Index];\r
\r
if (Ep != NULL) {\r
- gBS->FreePool (Ep);\r
+ FreePool (Ep);\r
}\r
}\r
\r
- gBS->FreePool (Setting->Endpoints);\r
+ FreePool (Setting->Endpoints);\r
}\r
\r
- gBS->FreePool (Setting);\r
+ FreePool (Setting);\r
}\r
\r
\r
}\r
}\r
\r
- gBS->FreePool (Interface);\r
+ FreePool (Interface);\r
}\r
\r
- gBS->FreePool (Config->Interfaces);\r
+ FreePool (Config->Interfaces);\r
}\r
\r
- gBS->FreePool (Config);\r
+ FreePool (Config);\r
\r
}\r
\r
}\r
}\r
\r
- gBS->FreePool (DevDesc->Configs);\r
+ FreePool (DevDesc->Configs);\r
}\r
\r
- gBS->FreePool (DevDesc);\r
+ FreePool (DevDesc);\r
}\r
\r
\r
Create a descriptor.\r
\r
@param DescBuf The buffer of raw descriptor.\r
- @param Len The lenght of the raw descriptor buffer.\r
+ @param Len The length of the raw descriptor buffer.\r
@param Type The type of descriptor to create.\r
@param Consumed Number of bytes consumed.\r
\r
return NULL;\r
}\r
\r
- Desc = AllocateZeroPool (CtrlLen);\r
-\r
+ Desc = AllocateCopyPool(CtrlLen, Head);\r
if (Desc == NULL) {\r
return NULL;\r
}\r
-\r
- CopyMem (Desc, Head, DescLen);\r
*Consumed = Offset + Head->Len;\r
\r
return Desc;\r
\r
\r
/**\r
- Parse an interface desciptor and its endpoints.\r
+ Parse an interface descriptor and its endpoints.\r
\r
@param DescBuf The buffer of raw descriptor.\r
- @param Len The lenght of the raw descriptor buffer.\r
+ @param Len The length of the raw descriptor buffer.\r
@param Consumed The number of raw descriptor consumed.\r
\r
@return The create interface setting or NULL if failed.\r
Offset = Used;\r
\r
//\r
- // Create an arry to hold the interface's endpoints\r
+ // Create an array to hold the interface's endpoints\r
//\r
NumEp = Setting->Desc.NumEndpoints;\r
\r
Parse the configuration descriptor and its interfaces.\r
\r
@param DescBuf The buffer of raw descriptor.\r
- @param Len The lenght of the raw descriptor buffer.\r
+ @param Len The length of the raw descriptor buffer.\r
\r
@return The created configuration descriptor.\r
\r
);\r
\r
if (EFI_ERROR (Status)) {\r
- gBS->FreePool (Buf);\r
+ FreePool (Buf);\r
return NULL;\r
}\r
\r
Status = EFI_SUCCESS;\r
\r
Max = (Desc->Length - 2) / 2;\r
- Max = (Max < USB_MAX_LANG_ID ? Max : USB_MAX_LANG_ID);\r
-\r
+ Max = MIN(Max, USB_MAX_LANG_ID);\r
+ \r
Point = Desc->String;\r
for (Index = 0; Index < Max; Index++) {\r
UsbDev->LangId[Index] = *Point;\r
\r
/**\r
Retrieve the indexed configure for the device. USB device\r
- returns the configuration togetther with the interfaces for\r
+ returns the configuration together with the interfaces for\r
this configuration. Configuration descriptor is also of\r
variable length.\r
\r
if (EFI_ERROR (Status)) {\r
DEBUG (( EFI_D_ERROR, "UsbGetOneConfig: failed to get full descript %r\n", Status));\r
\r
- gBS->FreePool (Buf);\r
+ FreePool (Buf);\r
return NULL;\r
}\r
\r
\r
ConfigDesc = UsbParseConfigDesc ((UINT8 *) Config, Config->TotalLength);\r
\r
- gBS->FreePool (Config);\r
+ FreePool (Config);\r
\r
if (ConfigDesc == NULL) {\r
DEBUG (( EFI_D_ERROR, "UsbBuildDescTable: failed to parse configure (index %d)\n", Index));\r