summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorKen Lautner <kenlautner3@gmail.com>2024-08-23 15:39:53 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-09-04 00:53:54 +0000
commit559affab2e82aba4e0819d299d5a8de03e276af6 (patch)
treef3d5eb4e250a785b606ca0fe7c4d9b9040346b14 /MdeModulePkg
parentb17ac09cc4bb48692ec20ca583a8f70dc7d25d95 (diff)
downloadedk2-559affab2e82aba4e0819d299d5a8de03e276af6.tar.gz
edk2-559affab2e82aba4e0819d299d5a8de03e276af6.tar.bz2
edk2-559affab2e82aba4e0819d299d5a8de03e276af6.zip
MdeModulePkg: Fix redundant call to RestoreTpl()
Comments out a redundant call to RestoreTpl(). While this does not technically violate spec on raise/restore TPL, TPL should already be at the specified level. This extra call introduces an asymmetry between RaiseTpl and RestoreTpl calls, which makes analysis of TPL correctness more difficult and hampers certain non-standard TPL usages that some platforms require. Additionally, the two TPL variables were renamed to provide context for each of them. Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/Image/Image.c4
-rw-r--r--MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c12
2 files changed, 9 insertions, 7 deletions
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index 37fc74d5d1..8d12f93d7f 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -1725,7 +1725,9 @@ CoreStartImage (
// Image has completed. Verify the tpl is the same
//
ASSERT (Image->Tpl == gEfiCurrentTpl);
- CoreRestoreTpl (Image->Tpl);
+ if (Image->Tpl != gEfiCurrentTpl) {
+ CoreRestoreTpl (Image->Tpl);
+ }
CoreFreePool (Image->JumpBuffer);
diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
index 15dfa3699f..54b634afe3 100644
--- a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
+++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
@@ -846,8 +846,8 @@ DiskIo2ReadWriteDisk (
LIST_ENTRY Subtasks;
DISK_IO_SUBTASK *Subtask;
DISK_IO2_TASK *Task;
- EFI_TPL OldTpl;
- EFI_TPL OldTpl1;
+ EFI_TPL SubtaskPerformTpl;
+ EFI_TPL SubtaskLockTpl;
BOOLEAN Blocking;
BOOLEAN SubtaskBlocking;
LIST_ENTRY *SubtasksPtr;
@@ -897,7 +897,7 @@ DiskIo2ReadWriteDisk (
ASSERT (!IsListEmpty (SubtasksPtr));
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ SubtaskPerformTpl = gBS->RaiseTPL (TPL_CALLBACK);
for ( Link = GetFirstNode (SubtasksPtr), NextLink = GetNextNode (SubtasksPtr, Link)
; !IsNull (SubtasksPtr, Link)
; Link = NextLink, NextLink = GetNextNode (SubtasksPtr, NextLink)
@@ -978,7 +978,7 @@ DiskIo2ReadWriteDisk (
}
}
- OldTpl1 = gBS->RaiseTPL (TPL_NOTIFY);
+ SubtaskLockTpl = gBS->RaiseTPL (TPL_NOTIFY);
//
// Remove all the remaining subtasks when failure.
@@ -1013,8 +1013,8 @@ DiskIo2ReadWriteDisk (
FreePool (Task);
}
- gBS->RestoreTPL (OldTpl1);
- gBS->RestoreTPL (OldTpl);
+ gBS->RestoreTPL (SubtaskLockTpl);
+ gBS->RestoreTPL (SubtaskPerformTpl);
return Status;
}