瀏覽代碼

iommu/amd: Clean up the cmpxchg64 invocation

Change it as it's designed for and keep it consistent with other
places.

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Baoquan He 9 年之前
父節點
當前提交
134414fffc
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/iommu/amd_iommu.c

+ 2 - 1
drivers/iommu/amd_iommu.c

@@ -1342,7 +1342,8 @@ static u64 *alloc_pte(struct protection_domain *domain,
 
 			__npte = PM_LEVEL_PDE(level, virt_to_phys(page));
 
-			if (cmpxchg64(pte, __pte, __npte)) {
+			/* pte could have been changed somewhere. */
+			if (cmpxchg64(pte, __pte, __npte) != __pte) {
 				free_page((unsigned long)page);
 				continue;
 			}