summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsnowpiaoling <1972997989@qq.com>2026-08-07 12:28:34 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-09-04 01:50:12 +0000
commit33ce6ba36d40f6a89cf8a0dc55ff358b938bda6d (patch)
tree1f9cfb29ed93e49506cb601e681add24b38188c9
parent955de2ab54bfee16789a5fd9a7bb75449a821eb5 (diff)
downloadedk2-33ce6ba36d40f6a89cf8a0dc55ff358b938bda6d.tar.gz
edk2-33ce6ba36d40f6a89cf8a0dc55ff358b938bda6d.zip
EmbeddedPkg: MmcIoBlocks: Fix logical error in timeout
In eMMC status detection logic in the `MmcIoBlocks' function, if a timeout occurs, the Timeout variable will end with a value -1 as the self- subtraction operation is performed after determining 0 in the while loop. This means that the function could never return a `EFI_NOT_READY' status. As Timeout is of a signed type, change the conditional statement to less-than-or-equal to 0 to fix timeout/busy detection. Signed-off-by: snowpiaoling <1972997989@qq.com>
-rw-r--r--EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
index e6ad40ebb8..0fcacf7f0e 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
@@ -334,7 +334,7 @@ MmcIoBlocks (
gBS->Stall (1);
}
- if (0 == Timeout) {
+ if (Timeout < 0) {
DEBUG ((DEBUG_ERROR, "The Card is busy\n"));
return EFI_NOT_READY;
}