]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyBlock.c
IntelFrameworkModulePkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / IsaFloppyDxe / IsaFloppyBlock.c
index 4076f5396515d755245c9b3eb1f6f5709900707e..2dce7ac7e0b717568195ee5cbd6bef4e40c2425d 100644 (file)
@@ -1,7 +1,7 @@
-/** @file \r
+/** @file\r
   Implementation of the EFI Block IO Protocol for ISA Floppy driver\r
-  \r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -71,7 +71,7 @@ FddFlushBlocks (
 \r
 /**\r
   Common report status code interface.\r
-  \r
+\r
   @param This  Pointer of FDC_BLK_IO_DEV instance\r
   @param Read  Read or write operation when error occurrs\r
 **/\r
@@ -107,7 +107,7 @@ FddReportStatus (
   @retval EFI_NO_MEDIA          There is no media in the device.\r
   @retval EFI_MEDIA_CHANGED     The MediaId does not matched the current device.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
 \r
 **/\r
@@ -148,7 +148,7 @@ FddReadBlocks (
   @retval EFI_NO_MEDIA          There is no media in the device.\r
   @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
 \r
 **/\r
@@ -189,7 +189,7 @@ FddWriteBlocks (
   @retval EFI_NO_MEDIA          There is no media in the device.\r
   @retval EFI_MEDIA_CHANGED     The MediaId does not matched the current device.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
   @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
 \r
@@ -225,16 +225,7 @@ FddReadWriteBlocks (
       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
@@ -268,6 +259,11 @@ FddReadWriteBlocks (
     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
@@ -277,6 +273,11 @@ FddReadWriteBlocks (
   //\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
@@ -358,9 +359,9 @@ FddReadWriteBlocks (
 \r
 /**\r
   Free cache for a floppy disk.\r
-  \r
+\r
   @param FdcDev  A Pointer to FDC_BLK_IO_DEV instance\r
-  \r
+\r
 **/\r
 VOID\r
 FdcFreeCache (\r