)\r
{\r
EFI_STATUS Status;\r
+ UINT8 Buffer[1];\r
\r
//\r
- // Read 1 byte from offset 0 but passing NULL as buffer pointer\r
+ // Read 1 byte from offset 0 to check if the MediaId is still valid.\r
+ // The reading operation is synchronious thus it is not worth it to\r
+ // allocate a buffer from the pool. The destination buffer for the\r
+ // data is in the stack.\r
//\r
- Status = DiskIo->ReadDisk (DiskIo, MediaId, 0, 1, NULL);\r
+ Status = DiskIo->ReadDisk (DiskIo, MediaId, 0, 1, (VOID*)Buffer);\r
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {\r
return Status;\r
}\r