FdcFreeCache (FdcDev);\r
}\r
}\r
- //\r
- // Check the Parameter is valid\r
- //\r
- if (Buffer == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
\r
- if (BufferSize == 0) {\r
- return EFI_SUCCESS;\r
- }\r
//\r
// Set the drive motor on\r
//\r
return EFI_MEDIA_CHANGED;\r
}\r
\r
+ if (BufferSize == 0) {\r
+ MotorOff (FdcDev);\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
if (Operation == WRITE) {\r
if (Media->ReadOnly) {\r
MotorOff (FdcDev);\r
//\r
// Check the parameters for this read/write operation\r
//\r
+ if (Buffer == NULL) {\r
+ MotorOff (FdcDev);\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
if (BufferSize % BlockSize != 0) {\r
MotorOff (FdcDev);\r
return EFI_BAD_BUFFER_SIZE;\r