From patchwork Thu Oct 29 08:41:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Rozenfeld X-Patchwork-Id: 56429 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9T8fU7S024486 for ; Thu, 29 Oct 2009 08:41:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753708AbZJ2IlX (ORCPT ); Thu, 29 Oct 2009 04:41:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752488AbZJ2IlX (ORCPT ); Thu, 29 Oct 2009 04:41:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28251 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752153AbZJ2IlX (ORCPT ); Thu, 29 Oct 2009 04:41:23 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9T8fRco026674 for ; Thu, 29 Oct 2009 04:41:28 -0400 Received: from localhost.localdomain (vpn-6-121.tlv.redhat.com [10.35.6.121]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9T8fNf7009401 for ; Thu, 29 Oct 2009 04:41:25 -0400 Message-ID: <4AE95531.1060102@redhat.com> Date: Thu, 29 Oct 2009 10:41:21 +0200 From: Vadim Rozenfeld User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: kvm@vger.kernel.org Subject: [PATCH] viostor driver. fix PREfast warnings. X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/viostor/virtio_pci.c b/viostor/virtio_pci.c index a72b019..78a6d29 100644 --- a/viostor/virtio_pci.c +++ b/viostor/virtio_pci.c @@ -183,6 +183,10 @@ VirtIODeviceFindVirtualQueue( // activate the queue pa = ScsiPortGetPhysicalAddress(DeviceExtension, NULL, info->queue,&dummy); + if(!pa.QuadPart) { + ScsiPortWritePortUlong((PULONG)(adaptExt->device_base + VIRTIO_PCI_QUEUE_PFN),(ULONG)0); + return NULL; + } pageNum = (ULONG)(pa.QuadPart>> PAGE_SHIFT); RhelDbgPrint(TRACE_LEVEL_FATAL, ("[%s] queue phys.address %08lx:%08lx, pfn %lx\n", __FUNCTION__, pa.u.HighPart, pa.u.LowPart, pageNum)); ScsiPortWritePortUlong((PULONG)(adaptExt->device_base + VIRTIO_PCI_QUEUE_PFN),(ULONG)(pageNum)); diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c index 8b91e62..c36b85b 100644 --- a/viostor/virtio_stor.c +++ b/viostor/virtio_stor.c @@ -247,29 +247,6 @@ VirtIoFindAdapter( return SP_RETURN_NOT_FOUND; } - if (!ScsiPortValidateRange(DeviceExtension, - ConfigInfo->AdapterInterfaceType, - ConfigInfo->SystemIoBusNumber, - accessRange->RangeStart, - accessRange->RangeLength, - (BOOLEAN)!accessRange->RangeInMemory)) { - - ScsiPortLogError(DeviceExtension, - NULL, - 0, - 0, - 0, - SP_INTERNAL_ADAPTER_ERROR, - __LINE__); - - RhelDbgPrint(TRACE_LEVEL_FATAL, ("Range validation failed %x for %x bytes\n", - (*ConfigInfo->AccessRanges)[0].RangeStart.LowPart, - (*ConfigInfo->AccessRanges)[0].RangeLength)); - - return SP_RETURN_ERROR; - } - - ConfigInfo->NumberOfBuses = 1; ConfigInfo->MaximumNumberOfTargets = 1; ConfigInfo->MaximumNumberOfLogicalUnits = 1; @@ -707,7 +684,7 @@ VirtIoAdapterControl( RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("ScsiRestartAdapter\n")); adaptExt->pci_vq_info.vq = NULL; #ifdef MSI_SUPPORTED - if(!adaptExt->dump_mode& adaptExt->msix_vectors) { + if(!adaptExt->dump_mode&& adaptExt->msix_vectors) { adaptExt->pci_vq_info.vq = VirtIODeviceFindVirtualQueue(DeviceExtension, 0, adaptExt->msix_vectors); } #endif