Really sorry, After referring to the Information Technology - AT Attachment with Packet Interface (ATA/ATAPI) Specification, It seems to me that the commands being executed in function SetDriveParameters() are not mandatory during device initialization.
1. INITIALIZE DEVICE PARAMETERS command (ID 0x91h): This command got obsoleted since ATA/ATAPI-6 spec version. Also, the return status of SetDriveParameters() is irrelevant with the execution result of this command. 2. SET MULTIPLE MODE command (ID 0xC6h): My take is that this command is necessary if there is subsequent usage of command READ MULTIPLE, READ MULTIPLE EXT, WRITE MULTIPLE, or WRITE MULTIPLE EXT. I do not find usage of the above 4 commands within edk2, so I think the successful execution of SET MULTIPLE MODE command is not mandatory for detecting hard disk device. Based on the above findings, could you help to update the patch to: Status = SetDriveParameters (Instance, IdeChannel, IdeDevice, &DriveParameters, NULL); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "Set Drive Parameters Fail, Status = %r\n", Status)); } Will doing so still please Coverity? Best Regards, Hao Wu > -----Original Message----- > From: Ranbir Singh <rsi...@ventanamicro.com> > Sent: Friday, June 9, 2023 8:33 PM > To: devel@edk2.groups.io; rsi...@ventanamicro.com > Cc: Wu, Hao A <hao.a...@intel.com>; Ni, Ray <ray...@intel.com> > Subject: [PATCH v2 2/2] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: Fix > UNUSED_VALUE Coverity issue > > From: Ranbir Singh <ranbir.sin...@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. > > Add error check as is done after calls to SetDeviceTransferMode. > > Cc: Hao A Wu <hao.a...@intel.com> > Cc: Ray Ni <ray...@intel.com> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4204 > Signed-off-by: Ranbir Singh <ranbir.sin...@dell.com> > Signed-off-by: Ranbir Singh <rsi...@ventanamicro.com> > --- > > Notes: > Add error check instead of Status storage removal > > MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c > b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c > index 75403886e44a..d04b1d95a7f5 100644 > --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c > +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c > @@ -2549,13 +2549,18 @@ 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); > > + > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "Set Drive Parameters Fail, Status = %r\n", > Status)); > > + continue; > > + } > > } > > > > // > > -- > 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106844): https://edk2.groups.io/g/devel/message/106844 Mute This Topic: https://groups.io/mt/99432080/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-