summaryrefslogtreecommitdiff
path: root/EmbeddedPkg/SerialDxe
diff options
context:
space:
mode:
Diffstat (limited to 'EmbeddedPkg/SerialDxe')
-rw-r--r--EmbeddedPkg/SerialDxe/SerialIo.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/EmbeddedPkg/SerialDxe/SerialIo.c b/EmbeddedPkg/SerialDxe/SerialIo.c
index 612543be14..b9ea4b9c42 100644
--- a/EmbeddedPkg/SerialDxe/SerialIo.c
+++ b/EmbeddedPkg/SerialDxe/SerialIo.c
@@ -188,10 +188,12 @@ SerialRead (
OUT VOID *Buffer
)
{
- UINTN Count;
+ UINTN Count = 0;
- Count = SerialPortRead (Buffer, *BufferSize);
- *BufferSize = Count;
+ if (SerialPortPoll()) {
+ Count = SerialPortRead (Buffer, *BufferSize);
+ *BufferSize = Count;
+ }
return (Count == 0) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
}