MdeModulePkg/SataControllerDxe: Fix up ASSERTS (Private != NULL)

ASSERT (Private != NULL) (where Private = CR(...)) is ineffective as
CR(Ptr, Type, Member, Sig) either returns Ptr - offsetof(Type, Member),
or ASSERTS on the signature, so it's unlikely to ever return NULL (must
be passed a pointer = member's offset, or in this case, 0x4).

ASSERT on This != NULL instead.

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
Pedro Falcato 2023-06-01 18:27:32 +01:00 committed by mergify[bot]
parent 82b81c6464
commit 2bc46e67b6
1 changed files with 4 additions and 5 deletions

View File

@ -611,7 +611,6 @@ SataControllerStop (
}
Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (IdeInit);
ASSERT (Private != NULL);
//
// Uninstall the IDE Controller Init Protocol from this instance
@ -745,8 +744,8 @@ IdeInitGetChannelInfo (
{
EFI_SATA_CONTROLLER_PRIVATE_DATA *Private;
ASSERT (This != NULL);
Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
ASSERT (Private != NULL);
if (Channel < This->ChannelCount) {
*Enabled = TRUE;
@ -845,8 +844,8 @@ IdeInitSubmitData (
EFI_SATA_CONTROLLER_PRIVATE_DATA *Private;
UINTN DeviceIndex;
ASSERT (This != NULL);
Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
ASSERT (Private != NULL);
if ((Channel >= This->ChannelCount) || (Device >= Private->DeviceCount)) {
return EFI_INVALID_PARAMETER;
@ -924,8 +923,8 @@ IdeInitDisqualifyMode (
EFI_SATA_CONTROLLER_PRIVATE_DATA *Private;
UINTN DeviceIndex;
ASSERT (This != NULL);
Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
ASSERT (Private != NULL);
if ((Channel >= This->ChannelCount) || (BadModes == NULL) || (Device >= Private->DeviceCount)) {
return EFI_INVALID_PARAMETER;
@ -1017,8 +1016,8 @@ IdeInitCalculateMode (
EFI_STATUS Status;
UINTN DeviceIndex;
ASSERT (This != NULL);
Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
ASSERT (Private != NULL);
if ((Channel >= This->ChannelCount) || (SupportedModes == NULL) || (Device >= Private->DeviceCount)) {
return EFI_INVALID_PARAMETER;