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
This commit is contained in:
Olivier Martin 2014-03-01 10:59:25 +00:00 committed by oliviermartin
parent f0247796cb
commit 992a1f830d
1 changed files with 17 additions and 17 deletions

View File

@ -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
@ -32,52 +32,50 @@ 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:
@ -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;
}