From ad3d14ac105192dac5c58832f2d88df850a9cc8d Mon Sep 17 00:00:00 2001 From: "Guo, Jade" Date: Fri, 20 Sep 2024 23:21:50 +0800 Subject: [PATCH] Fix unused value The return values of some functions are ignored. Add DEBUG log while continue the code flow without quit early. Include: UsbdSetAddress UsbdGetStringDesc UsbdGetConfigDesc UsbdGetConfig UsbdSetConfig UsbdGetStatus VirtioRpmbInitialize Tracked-On: OAM-124684 Signed-off-by: Guo, Jade --- drivers/dw3/dw3.c | 22 ++++++++++++++++++---- drivers/virtual_media/virtual_media.c | 4 ++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/dw3/dw3.c b/drivers/dw3/dw3.c index 726444b..4d713c9 100644 --- a/drivers/dw3/dw3.c +++ b/drivers/dw3/dw3.c @@ -532,10 +532,6 @@ UsbdSetConfig ( } } - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "UsbdSetConfig() - Invalid requested configuration value: %i\n", CfgValue)); - } - return Status; } @@ -580,6 +576,9 @@ UsbdSetupHdlr ( CtrlRequest->Length, &(mCtrlIoReq.IoInfo.Length) ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "UsbdGetConfigDesc() - EFI_DEVICE_ERROR")); + } break; case USB_DESC_TYPE_STRING: @@ -591,6 +590,9 @@ UsbdSetupHdlr ( CtrlRequest->Length, &(mCtrlIoReq.IoInfo.Length) ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "UsbdGetStringDesc() - EFI_DEVICE_ERROR")); + } break; #ifdef SUPPORT_SUPER_SPEED @@ -621,6 +623,9 @@ UsbdSetupHdlr ( DEBUG ((DEBUG_INFO, "USB_REQ_GET_CONFIG\n")); if (CtrlRequest->RequestType == USB_RT_TX_DIR_D_TO_H) { Status = UsbdGetConfig (mCtrlIoReq.IoInfo.Buffer, CtrlRequest->Length, &(mCtrlIoReq.IoInfo.Length)); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "UsbdGetConfig() - EFI_DEVICE_ERROR")); + } } else { DEBUG ((DEBUG_INFO, "UsbdSetupHdlr: Invalid direction for USB_REQ_GET_CONFIG request\n")); } @@ -630,6 +635,9 @@ UsbdSetupHdlr ( DEBUG ((DEBUG_INFO, "USB_REQ_SET_CONFIG\n")); if (CtrlRequest->RequestType == USB_RT_TX_DIR_H_TO_D) { Status = UsbdSetConfig ((UINT8)CtrlRequest->Value); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "UsbdSetConfig() - Invalid requested configuration value: %i\n", CfgValue)); + } } else { DEBUG ((DEBUG_INFO, "UsbdSetupHdlr: Invalid direction for USB_REQ_SET_CONFIG request\n")); } @@ -639,6 +647,9 @@ UsbdSetupHdlr ( DEBUG ((DEBUG_INFO, "USB_REQ_SET_ADDRESS\n")); if (CtrlRequest->RequestType == USB_RT_TX_DIR_H_TO_D) { Status = UsbdSetAddress ((UINT8)CtrlRequest->Value); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "UsbdSetAddress: EFI_DEVICE_ERROR\n")); + } } else { DEBUG ((DEBUG_INFO, "UsbdSetupHdlr: Invalid direction for USB_REQ_SET_ADDRESS request\n")); } @@ -648,6 +659,9 @@ UsbdSetupHdlr ( DEBUG ((DEBUG_INFO, "USB_REQ_GET_STATUS\n")); if (CtrlRequest->RequestType & USB_RT_TX_DIR_D_TO_H) { Status = UsbdGetStatus (mCtrlIoReq.IoInfo.Buffer, CtrlRequest->RequestType, CtrlRequest->Length, &(mCtrlIoReq.IoInfo.Length)); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "UsbdGetStatus: EFI_DEVICE_ERROR\n")); + } } else { DEBUG ((DEBUG_INFO, "UsbdSetupHdlr: Invalid direction for USB_REQ_GET_STATUS request\n")); } diff --git a/drivers/virtual_media/virtual_media.c b/drivers/virtual_media/virtual_media.c index 55b5ff3..4cb4291 100755 --- a/drivers/virtual_media/virtual_media.c +++ b/drivers/virtual_media/virtual_media.c @@ -64,6 +64,10 @@ static EFI_STATUS _init(storage_t *s) if (pci_dev[VirtualRpmb]) ret = VirtioRpmbInitialize((UINTN)pci_dev[VirtualRpmb]); + if (EFI_ERROR(ret)) { + ewerr ("VirtioRpmbInitialize Error %x\n",(UINT32)ret); + //return ret; + } ret = VirtioGetMediaInfo(DEVICE_INDEX_DEFAULT, &BlockInfo); if (EFI_ERROR(ret)) {