vendorcode/amd: Fix non-terminating loop
Code is copied from agesa/common's amdlib.c. Things can probably be deduplicated. Change-Id: I9c8adab5db7e9fd41aecc522136dfa705c1e2ee6 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Found-by: Coverity Scan #1229662 Reviewed-on: https://review.coreboot.org/17834 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
a1df15efc8
commit
cf3b306caf
|
@ -381,11 +381,17 @@ LibAmdBitScanReverse (
|
||||||
IN UINT32 value
|
IN UINT32 value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
uint8_t bit = 31;
|
||||||
for (Index = 31; Index >= 0; Index--){
|
do {
|
||||||
if (value & (1 << Index)) break;
|
if (value & (1 << 31))
|
||||||
}
|
return bit;
|
||||||
return (UINT8) Index;
|
|
||||||
|
value <<= 1;
|
||||||
|
bit--;
|
||||||
|
|
||||||
|
} while (value != 0);
|
||||||
|
|
||||||
|
return 0xFF; /* Error code indicating no bit found */
|
||||||
}
|
}
|
||||||
|
|
||||||
AMDLIB_OPTIMIZE
|
AMDLIB_OPTIMIZE
|
||||||
|
|
Loading…
Reference in New Issue