[USBSTOR]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 23 Jan 2012 02:58:52 +0000 (02:58 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 23 Jan 2012 02:58:52 +0000 (02:58 +0000)
- Fix attempt #2  the offset bug
- fix identation

svn path=/branches/usb-bringup-trunk/; revision=55089

drivers/usb/usbstor/scsi.c

index 4966309..6db9e1d 100644 (file)
@@ -589,12 +589,16 @@ USBSTOR_SendRequest(
                 if (CommandLength == UFI_READ_WRITE_CMD_LEN)
                 {
                     MdlVirtualAddress = MmGetMdlVirtualAddress(OriginalRequest->MdlAddress);
+
+                    //
+                    // is there an offset
+                    //
                     if (MdlVirtualAddress != Context->TransferData)
-                                       {
+                    {
                         //
                         // lets build an mdl
                         //
-                                               Context->TransferBufferMDL = IoAllocateMdl(Context->TransferData, MmGetMdlByteCount(OriginalRequest->MdlAddress), FALSE, FALSE, NULL);
+                        Context->TransferBufferMDL = IoAllocateMdl(Context->TransferData, MmGetMdlByteCount(OriginalRequest->MdlAddress), FALSE, FALSE, NULL);
                         if (!Context->TransferBufferMDL)
                         {
                             //
@@ -603,17 +607,20 @@ USBSTOR_SendRequest(
                             return STATUS_INSUFFICIENT_RESOURCES;
                         }
 
-                                               //
-                                               // now build the partial mdl
-                                               //
-                                               IoBuildPartialMdl(OriginalRequest->MdlAddress, Context->TransferBufferMDL, Context->TransferData, Context->TransferDataLength);
-                                       }
+                        //
+                        // now build the partial mdl
+                        //
+                        IoBuildPartialMdl(OriginalRequest->MdlAddress, Context->TransferBufferMDL, Context->TransferData, Context->TransferDataLength);
+                    }
                 }
 
-                //
-                // I/O paging request
-                //
-                Context->TransferBufferMDL = OriginalRequest->MdlAddress;
+                if (!Context->TransferBufferMDL)
+                {
+                    //
+                    // I/O paging request
+                    //
+                    Context->TransferBufferMDL = OriginalRequest->MdlAddress;
+                }
             }
             else
             {