diff options
author | Pedro Falcato <pedro.falcato@gmail.com> | 2023-06-01 18:27:32 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-06-01 18:08:33 +0000 |
commit | 2bc46e67b67c64455f3fccf22b533fad4393a563 (patch) | |
tree | 5ebb8148b361787f2213488ac708a4631e941f65 | |
parent | 82b81c64643bb08ba5bf928c5861d6e82b12f160 (diff) | |
download | edk2-2bc46e67b67c64455f3fccf22b533fad4393a563.tar.gz edk2-2bc46e67b67c64455f3fccf22b533fad4393a563.tar.bz2 edk2-2bc46e67b67c64455f3fccf22b533fad4393a563.zip |
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>
-rw-r--r-- | MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c index f0ffd311d7..ea0116071c 100644 --- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c +++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c @@ -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;
|