From: Joerg Roedel <jroedel@suse.de>
Date: Wed, 6 Jul 2016 12:50:35 +0200
Subject: iommu/amd: Allow NULL pointer parameter for domain_flush_complete()
Git-commit: f1eae7c58036b30d434d84a34c6c3154bfb5b496
Patch-mainline: v4.8-rc1
References: fate#321026

If domain == NULL is passed to the function, it will queue a
completion-wait command on all IOMMUs in the system.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/amd_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1176,7 +1176,7 @@ static void domain_flush_complete(struct
 	int i;
 
 	for (i = 0; i < amd_iommus_present; ++i) {
-		if (!domain->dev_iommu[i])
+		if (domain && !domain->dev_iommu[i])
 			continue;
 
 		/*
