提交 37b5fc99 编写于 作者: G Goldfish64

OcAudioLib: Fix previous commit

上级 c6509d41
......@@ -176,6 +176,7 @@ CHAR8 *mColors[HDA_CONFIG_DEFAULT_COLOR_OTHER + 1] =
};
STATIC
EFIAPI
VOID
PrintHdaBuffer (
IN OUT CHAR8 **AsciiBuffer,
......@@ -190,14 +191,14 @@ PrintHdaBuffer (
CHAR8 *NewBuffer;
UINTN NewBufferSize;
VA_START (Marker, FormatString);
AsciiVSPrint (Tmp, sizeof (Tmp), FormatString, Marker);
VA_END (Marker);
if (*AsciiBuffer == NULL) {
return;
}
VA_START (Marker, FormatString);
AsciiVSPrint (Tmp, sizeof (Tmp), FormatString, Marker);
VA_END (Marker);
Status = AsciiStrCatS (*AsciiBuffer, *AsciiBufferSize, Tmp);
if (Status == EFI_BUFFER_TOO_SMALL) {
if (OcOverflowMulUN (*AsciiBufferSize, 2, &NewBufferSize)) {
......@@ -205,6 +206,11 @@ PrintHdaBuffer (
}
NewBuffer = ReallocatePool (*AsciiBufferSize, NewBufferSize, *AsciiBuffer);
if (NewBuffer == NULL) {
FreePool (*AsciiBuffer);
*AsciiBuffer = NULL;
*AsciiBufferSize = 0;
return;
}
......@@ -616,11 +622,13 @@ OcAudioDump (
//
// Save dumped controller data to file.
//
UnicodeSPrint (TmpFileName, sizeof (TmpFileName), L"Controller%u.txt", Index);
Status = SetFileData (Root, TmpFileName, FileBuffer, AsciiStrSize (FileBuffer));
DEBUG ((DEBUG_INFO, "OCAU: Dumped HDA controller %u info result - %r\n", Index, Status));
if (FileBuffer != NULL) {
UnicodeSPrint (TmpFileName, sizeof (TmpFileName), L"Controller%u.txt", Index);
Status = SetFileData (Root, TmpFileName, FileBuffer, (UINT32) AsciiStrSize (FileBuffer));
DEBUG ((DEBUG_INFO, "OCAU: Dumped HDA controller %u info result - %r\n", Index, Status));
FreePool (FileBuffer);
FreePool (FileBuffer);
}
}
//
......@@ -714,11 +722,13 @@ OcAudioDump (
//
// Save dumped codec data to file.
//
UnicodeSPrint (TmpFileName, sizeof (TmpFileName), L"Codec%u.txt", Index);
Status = SetFileData (Root, TmpFileName, FileBuffer, AsciiStrSize (FileBuffer));
DEBUG ((DEBUG_INFO, "OCAU: Dumped HDA codec %u info result - %r\n", Index, Status));
if (FileBuffer != NULL) {
UnicodeSPrint (TmpFileName, sizeof (TmpFileName), L"Codec%u.txt", Index);
Status = SetFileData (Root, TmpFileName, FileBuffer, (UINT32) AsciiStrSize (FileBuffer));
DEBUG ((DEBUG_INFO, "OCAU: Dumped HDA codec %u info result - %r\n", Index, Status));
FreePool (FileBuffer);
FreePool (FileBuffer);
}
}
return EFI_SUCCESS;
......
......@@ -33,8 +33,9 @@ HdaCodecInfoGetAddress (
{
HDA_CODEC_INFO_PRIVATE_DATA *HdaPrivateData;
ASSERT (This != NULL);
ASSERT (Address != NULL);
if (This == NULL || Address == NULL) {
return EFI_INVALID_PARAMETER;
}
HdaPrivateData = HDA_CODEC_INFO_PRIVATE_DATA_FROM_THIS (This);
......
......@@ -33,8 +33,9 @@ HdaControllerInfoGetName (
{
HDA_CONTROLLER_INFO_PRIVATE_DATA *HdaPrivateData;
ASSERT (This != NULL);
ASSERT (Name != NULL);
if (This == NULL || Name == NULL) {
return EFI_INVALID_PARAMETER;
}
HdaPrivateData = HDA_CONTROLLER_INFO_PRIVATE_DATA_FROM_THIS (This);
*Name = HdaPrivateData->HdaControllerDev->Name;
......@@ -51,8 +52,9 @@ HdaControllerInfoGetVendorId (
{
HDA_CONTROLLER_INFO_PRIVATE_DATA *HdaPrivateData;
ASSERT (This != NULL);
ASSERT (VendorId != NULL);
if (This == NULL || VendorId == NULL) {
return EFI_INVALID_PARAMETER;
}
HdaPrivateData = HDA_CONTROLLER_INFO_PRIVATE_DATA_FROM_THIS (This);
*VendorId = HdaPrivateData->HdaControllerDev->VendorId;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册