First of all BASE_LIST_FOR_EACH_SAFE doesn't have any sanity checks. So its usage isn't "safe". We can drop this loop and use just IsNodeInList
Cc: Marvin Häuser <mhaeu...@posteo.de> Cc: Pedro Falcato <pedro.falc...@gmail.com> Cc: Vitaly Cheptsov <vit9...@protonmail.com> Signed-off-by: Savva Mitrofanov <savva...@gmail.com> --- Features/Ext4Pkg/Ext4Dxe/Directory.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c b/Features/Ext4Pkg/Ext4Dxe/Directory.c index 96c84c24243e..d1038c04926e 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Directory.c +++ b/Features/Ext4Pkg/Ext4Dxe/Directory.c @@ -537,20 +537,8 @@ Ext4RemoveDentry ( IN OUT EXT4_DENTRY *ToBeRemoved ) { - EXT4_DENTRY *D; - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - - BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Parent->Children) { - D = EXT4_DENTRY_FROM_DENTRY_LIST (Entry); - - if (D == ToBeRemoved) { - RemoveEntryList (Entry); - return; - } - } - - DEBUG ((DEBUG_ERROR, "[ext4] Ext4RemoveDentry did not find the asked-for dentry\n")); + ASSERT (IsNodeInList (&ToBeRemoved->ListNode, &Parent->Children)); + RemoveEntryList (&ToBeRemoved->ListNode); } /** -- 2.37.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#91653): https://edk2.groups.io/g/devel/message/91653 Mute This Topic: https://groups.io/mt/92531469/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-