From 084636c5189d0d2a67985067f6c002441e3ed931 Mon Sep 17 00:00:00 2001 From: Rok Mandeljc Date: Thu, 1 Nov 2007 08:08:13 +0100 Subject: [PATCH] wnaspi32: Call ASPI_GetNumControllers() only once. --- dlls/wnaspi32/winaspi32.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/wnaspi32/winaspi32.c b/dlls/wnaspi32/winaspi32.c index e06bb9bb6f6..0f8e2f9e40a 100644 --- a/dlls/wnaspi32/winaspi32.c +++ b/dlls/wnaspi32/winaspi32.c @@ -308,6 +308,7 @@ ASPI_ExecScsiCmd(SRB_ExecSCSICmd *lpPRB) WORD ret; DWORD status; int in_len, out_len; + int num_controllers = 0; int error_code = 0; int fd; DWORD SRB_Status; @@ -343,9 +344,11 @@ ASPI_ExecScsiCmd(SRB_ExecSCSICmd *lpPRB) break; } ASPI_DebugPrintCmd(lpPRB); - if (lpPRB->SRB_HaId > ASPI_GetNumControllers()) { - ERR("Failed: Wanted hostadapter %d, but we have only %d.\n", - lpPRB->SRB_HaId,ASPI_GetNumControllers() + + 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 ); } -- 2.11.4.GIT