[edk2-devel] [PATCH v4 2/2] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: Fix UNUSED_VALUE Coverity issue
Ranbir Singh
rsingh at ventanamicro.com
Mon Jul 17 04:24:44 UTC 2023
From: Ranbir Singh <Ranbir.Singh3 at Dell.com>
The return value stored in Status after call to SetDriveParameters
is not made of any use thereafter and hence it remains as UNUSED.
Based on Hao's findings (https://edk2.groups.io/g/devel/message/106844),
the successful execution of SetDriveParameters() is not mandatory for
initializing IDE mode of a hard disk device. Hence remove the 'Status'
assignment of the return value from SetDriveParameters() and instead add
error checks & DEBUG_WARN level messages within SetDriveParameters()
function after sending INIT_DRIVE_PARAM & SET_MULTIPLE_MODE ATA commands.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4204
Cc: Hao A Wu <hao.a.wu at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Signed-off-by: Ranbir Singh <Ranbir.Singh3 at Dell.com>
Signed-off-by: Ranbir Singh <rsingh at ventanamicro.com>
---
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
index 75403886e44a..19d7b4930cb7 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
@@ -1992,6 +1992,10 @@ SetDriveParameters (
NULL
);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN, "Init Drive Parameters Fail, Status = %r\n", Status));
+ }
+
//
// Send Set Multiple parameters
//
@@ -2008,6 +2012,10 @@ SetDriveParameters (
NULL
);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN, "Set Multiple Mode Parameters Fail, Status = %r\n", Status));
+ }
+
return Status;
}
@@ -2549,13 +2557,13 @@ DetectAndConfigIdeDevice (
//
if (DeviceType == EfiIdeHarddisk) {
//
- // Init driver parameters
+ // Init drive parameters
//
DriveParameters.Sector = (UINT8)((ATA5_IDENTIFY_DATA *)(&Buffer.AtaData))->sectors_per_track;
DriveParameters.Heads = (UINT8)(((ATA5_IDENTIFY_DATA *)(&Buffer.AtaData))->heads - 1);
DriveParameters.MultipleSector = (UINT8)((ATA5_IDENTIFY_DATA *)(&Buffer.AtaData))->multi_sector_cmd_max_sct_cnt;
- Status = SetDriveParameters (Instance, IdeChannel, IdeDevice, &DriveParameters, NULL);
+ SetDriveParameters (Instance, IdeChannel, IdeDevice, &DriveParameters, NULL);
}
//
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106990): https://edk2.groups.io/g/devel/message/106990
Mute This Topic: https://groups.io/mt/100212105/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list