Moving the test right after domain is assigned. Signed-off-by: Fred R. Oxhey <fr@xxxxxxxxxxxxx> --- virt/kvm/iommu.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index e9fff98..8d2e1dc 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -287,13 +287,13 @@ static void kvm_iommu_put_pages(struct kvm *kvm, u64 phys; domain = kvm->arch.iommu_domain; - end_gfn = base_gfn + npages; - gfn = base_gfn; - /* check if iommu exists and in use */ if (!domain) return; + end_gfn = base_gfn + npages; + gfn = base_gfn; + while (gfn < end_gfn) { unsigned long unmap_pages; size_t size; -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html