[PATCH] wnaspi32: Do the command dumping and direction adjustment only after device has been verified and successfully opened (again, more readable traces).

Rok Mandeljc rok.mandeljc at email.si
Thu Nov 1 02:08:42 CDT 2007


---
 dlls/wnaspi32/winaspi32.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/dlls/wnaspi32/winaspi32.c b/dlls/wnaspi32/winaspi32.c
index faf266c..8c76878 100644
--- a/dlls/wnaspi32/winaspi32.c
+++ b/dlls/wnaspi32/winaspi32.c
@@ -313,6 +313,18 @@ ASPI_ExecScsiCmd(SRB_ExecSCSICmd *lpPRB)
   int	fd;
   DWORD SRB_Status;
 
+  num_controllers = ASPI_GetNumControllers();
+  if (lpPRB->SRB_HaId > num_controllers) {
+      WARN("Failed: Wanted hostadapter %d, but we have only %d.\n",
+	  lpPRB->SRB_HaId, num_controllers
+      );
+      return WNASPI32_DoPosting( lpPRB, SS_INVALID_HA );
+  }
+  fd = ASPI_OpenDevice(lpPRB);
+  if (fd == -1) {
+      return WNASPI32_DoPosting( lpPRB, SS_NO_DEVICE );
+  }
+    
   /* FIXME: hackmode */
 #define MAKE_TARGET_TO_HOST(lpPRB) \
   	if (!TARGET_TO_HOST(lpPRB)) { \
@@ -344,18 +356,6 @@ ASPI_ExecScsiCmd(SRB_ExecSCSICmd *lpPRB)
 	break;
   }
   ASPI_DebugPrintCmd(lpPRB);
-  
-  num_controllers = ASPI_GetNumControllers();
-  if (lpPRB->SRB_HaId > num_controllers) {
-      WARN("Failed: Wanted hostadapter %d, but we have only %d.\n",
-	  lpPRB->SRB_HaId, num_controllers
-      );
-      return WNASPI32_DoPosting( lpPRB, SS_INVALID_HA );
-  }
-  fd = ASPI_OpenDevice(lpPRB);
-  if (fd == -1) {
-      return WNASPI32_DoPosting( lpPRB, SS_NO_DEVICE );
-  }
 
   sg_hd = NULL;
   sg_reply_hdr = NULL;
-- 
1.5.3.3


--------------060900050303020100050207--



More information about the wine-patches mailing list