From 25e1235fe7218f631df10c13dbc55a279b6acfbf Mon Sep 17 00:00:00 2001
From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com>
Date: Tue, 9 Mar 2021 16:02:11 +0100
Subject: [PATCH] [FREELDR] Remove a few useless code lines (#3503)

CORE-14516
---
 boot/freeldr/freeldr/lib/fs/ext2.c   |  4 +---
 boot/freeldr/freeldr/lib/fs/fat.c    |  4 +---
 boot/freeldr/freeldr/ntldr/inffile.c | 12 +-----------
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/boot/freeldr/freeldr/lib/fs/ext2.c b/boot/freeldr/freeldr/lib/fs/ext2.c
index 65fae203e30..fa68cd9d96a 100644
--- a/boot/freeldr/freeldr/lib/fs/ext2.c
+++ b/boot/freeldr/freeldr/lib/fs/ext2.c
@@ -522,7 +522,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
         BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex];
 
         //
-        // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
+        // Now do the read and update BytesRead & FilePointer
         //
         if (!Ext2ReadPartialBlock(Volume, BlockNumber, 0, (ULONG)BytesToRead, Buffer))
         {
@@ -533,8 +533,6 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
             *BytesRead += BytesToRead;
         }
         Ext2FileInfo->FilePointer += BytesToRead;
-        BytesToRead -= BytesToRead;
-        Buffer = (PVOID)((ULONG_PTR)Buffer + (ULONG_PTR)BytesToRead);
     }
 
     return TRUE;
diff --git a/boot/freeldr/freeldr/lib/fs/fat.c b/boot/freeldr/freeldr/lib/fs/fat.c
index af0bcb1e7fd..1b98b63a27b 100644
--- a/boot/freeldr/freeldr/lib/fs/fat.c
+++ b/boot/freeldr/freeldr/lib/fs/fat.c
@@ -1341,7 +1341,7 @@ BOOLEAN FatReadFile(PFAT_FILE_INFO FatFileInfo, ULONG BytesToRead, ULONG* BytesR
         ASSERT(!FAT_IS_END_CLUSTER(FatFileInfo->CurrentCluster));
 
         //
-        // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
+        // Now do the read and update BytesRead & FilePointer
         //
         if (!FatReadPartialCluster(Volume, FatFileInfo->CurrentCluster, 0, BytesToRead, Buffer))
         {
@@ -1352,8 +1352,6 @@ BOOLEAN FatReadFile(PFAT_FILE_INFO FatFileInfo, ULONG BytesToRead, ULONG* BytesR
             *BytesRead += BytesToRead;
         }
         FatFileInfo->FilePointer += BytesToRead;
-        BytesToRead -= BytesToRead;
-        Buffer = (PVOID)((ULONG_PTR)Buffer + BytesToRead);
     }
 
     return TRUE;
diff --git a/boot/freeldr/freeldr/ntldr/inffile.c b/boot/freeldr/freeldr/ntldr/inffile.c
index eced0fe0ee7..a9dd7152eaf 100644
--- a/boot/freeldr/freeldr/ntldr/inffile.c
+++ b/boot/freeldr/freeldr/ntldr/inffile.c
@@ -1505,17 +1505,7 @@ InfGetData (
     if (Key != NULL)
         *Key = CacheKey->Key;
 
-    if (Data != NULL)
-    {
-        if (CacheKey->FirstField == NULL)
-        {
-            *Data = NULL;
-        }
-        else
-        {
-            *Data = CacheKey->FirstField->Data;
-        }
-    }
+    *Data = (CacheKey->FirstField == NULL) ? NULL : CacheKey->FirstField->Data;
 
     return TRUE;
 }