]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Fix Ecc error 5007 in ArmCacheMaintenanceLib
authorPierre Gondois <Pierre.Gondois@arm.com>
Thu, 10 Dec 2020 13:10:05 +0000 (13:10 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 6 Jan 2021 16:22:54 +0000 (16:22 +0000)
This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.c

index 440a5c372566bc28fc1e748eecf1b124fb995f8e..db9290f275db59cd0097d9a07f5845376d322caf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 \r
   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-  Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.\r
+  Copyright (c) 2011 - 2021, ARM Limited. All rights reserved.\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -20,11 +20,14 @@ CacheRangeOperation (
   IN  UINTN           LineLength\r
   )\r
 {\r
-  UINTN ArmCacheLineAlignmentMask  = LineLength - 1;\r
-\r
+  UINTN ArmCacheLineAlignmentMask;\r
   // Align address (rounding down)\r
-  UINTN AlignedAddress = (UINTN)Start - ((UINTN)Start & ArmCacheLineAlignmentMask);\r
-  UINTN EndAddress     = (UINTN)Start + Length;\r
+  UINTN AlignedAddress;\r
+  UINTN EndAddress;\r
+\r
+  ArmCacheLineAlignmentMask = LineLength - 1;\r
+  AlignedAddress = (UINTN)Start - ((UINTN)Start & ArmCacheLineAlignmentMask);\r
+  EndAddress     = (UINTN)Start + Length;\r
 \r
   // Perform the line operation on an address in each cache line\r
   while (AlignedAddress < EndAddress) {\r