diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-03-01 10:59:25 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-03-01 10:59:25 +0000 |
commit | 992a1f830d94d87d98c1e2066f46f00200bdfd4c (patch) | |
tree | 90a9a7b01dbbd5ac00ab6c91026843b77cae2b8c /ArmPkg | |
parent | f0247796cbc23568121463683fefe7a211d439e3 (diff) | |
download | edk2-platforms-992a1f830d94d87d98c1e2066f46f00200bdfd4c.tar.xz |
ArmPkg/ArmLib: Fix compilation error with -O3 switch
A warning is reported because ArmArchTimerReadReg may theoretically result
in an unititialised value.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15275 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg')
-rw-r--r-- | ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c index d04211b29d..fd82ef927b 100644 --- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c +++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c @@ -1,6 +1,6 @@ /** @file
*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
+* Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
@@ -12,7 +12,7 @@ *
**/
-#include <Uefi.h>
+#include <Uefi.h>
#include <Chipset/ArmV7.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
@@ -32,58 +32,56 @@ ArmArchTimerReadReg ( {
// Check if the Generic/Architecture timer is implemented
if (ArmIsArchTimerImplemented ()) {
-
switch (Reg) {
-
case CntFrq:
*((UINTN *)DstBuf) = ArmReadCntFrq ();
- break;
+ return;
case CntPct:
*((UINT64 *)DstBuf) = ArmReadCntPct ();
- break;
+ return;
case CntkCtl:
*((UINTN *)DstBuf) = ArmReadCntkCtl();
- break;
+ return;
case CntpTval:
*((UINTN *)DstBuf) = ArmReadCntpTval ();
- break;
+ return;
case CntpCtl:
*((UINTN *)DstBuf) = ArmReadCntpCtl ();
- break;
+ return;
case CntvTval:
*((UINTN *)DstBuf) = ArmReadCntvTval ();
- break;
+ return;
case CntvCtl:
*((UINTN *)DstBuf) = ArmReadCntvCtl ();
- break;
+ return;
case CntvCt:
*((UINT64 *)DstBuf) = ArmReadCntvCt ();
- break;
+ return;
case CntpCval:
*((UINT64 *)DstBuf) = ArmReadCntpCval ();
- break;
+ return;
case CntvCval:
*((UINT64 *)DstBuf) = ArmReadCntvCval ();
- break;
+ return;
case CntvOff:
*((UINT64 *)DstBuf) = ArmReadCntvOff ();
- break;
+ return;
case CnthCtl:
case CnthpTval:
case CnthpCtl:
case CnthpCval:
- DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n "));
+ DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n "));
break;
default:
@@ -93,6 +91,8 @@ ArmArchTimerReadReg ( DEBUG ((EFI_D_ERROR, "Attempt to read ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n "));
ASSERT (0);
}
+
+ *((UINT64 *)DstBuf) = 0;
}
VOID
@@ -208,7 +208,7 @@ ArmArchTimerGetTimerFreq ( VOID
)
{
- UINTN ArchTimerFreq = 0;
+ UINTN ArchTimerFreq;
ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
return ArchTimerFreq;
}
|