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 /** @file
* *
* Copyright (c) 2011, ARM Limited. All rights reserved. * Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
* *
* This program and the accompanying materials * This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License * 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 // Check if the Generic/Architecture timer is implemented
if (ArmIsArchTimerImplemented ()) { if (ArmIsArchTimerImplemented ()) {
switch (Reg) { switch (Reg) {
case CntFrq: case CntFrq:
*((UINTN *)DstBuf) = ArmReadCntFrq (); *((UINTN *)DstBuf) = ArmReadCntFrq ();
break; return;
case CntPct: case CntPct:
*((UINT64 *)DstBuf) = ArmReadCntPct (); *((UINT64 *)DstBuf) = ArmReadCntPct ();
break; return;
case CntkCtl: case CntkCtl:
*((UINTN *)DstBuf) = ArmReadCntkCtl(); *((UINTN *)DstBuf) = ArmReadCntkCtl();
break; return;
case CntpTval: case CntpTval:
*((UINTN *)DstBuf) = ArmReadCntpTval (); *((UINTN *)DstBuf) = ArmReadCntpTval ();
break; return;
case CntpCtl: case CntpCtl:
*((UINTN *)DstBuf) = ArmReadCntpCtl (); *((UINTN *)DstBuf) = ArmReadCntpCtl ();
break; return;
case CntvTval: case CntvTval:
*((UINTN *)DstBuf) = ArmReadCntvTval (); *((UINTN *)DstBuf) = ArmReadCntvTval ();
break; return;
case CntvCtl: case CntvCtl:
*((UINTN *)DstBuf) = ArmReadCntvCtl (); *((UINTN *)DstBuf) = ArmReadCntvCtl ();
break; return;
case CntvCt: case CntvCt:
*((UINT64 *)DstBuf) = ArmReadCntvCt (); *((UINT64 *)DstBuf) = ArmReadCntvCt ();
break; return;
case CntpCval: case CntpCval:
*((UINT64 *)DstBuf) = ArmReadCntpCval (); *((UINT64 *)DstBuf) = ArmReadCntpCval ();
break; return;
case CntvCval: case CntvCval:
*((UINT64 *)DstBuf) = ArmReadCntvCval (); *((UINT64 *)DstBuf) = ArmReadCntvCval ();
break; return;
case CntvOff: case CntvOff:
*((UINT64 *)DstBuf) = ArmReadCntvOff (); *((UINT64 *)DstBuf) = ArmReadCntvOff ();
break; return;
case CnthCtl: case CnthCtl:
case CnthpTval: 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 ")); DEBUG ((EFI_D_ERROR, "Attempt to read ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n "));
ASSERT (0); ASSERT (0);
} }
*((UINT64 *)DstBuf) = 0;
} }
VOID VOID
@ -208,7 +208,7 @@ ArmArchTimerGetTimerFreq (
VOID VOID
) )
{ {
UINTN ArchTimerFreq = 0; UINTN ArchTimerFreq;
ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq); ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
return ArchTimerFreq; return ArchTimerFreq;
} }