[-next,2/2] x86/mm/pat: Drop the unnecessary WARN_ON_ONCE if follow_phys fails

Message ID 20230306084316.2275757-3-mawupeng1@huawei.com
State New
Headers
Series Minor cleanup in PAT |

Commit Message

mawupeng March 6, 2023, 8:43 a.m. UTC
  From: Ma Wupeng <mawupeng1@huawei.com>

Since there is no obvious reason to keep this WARN_ON_ONCE if follow_phys
fails in track_pfn_copy/untrack_pfn, Drop it.

Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
---
 arch/x86/mm/pat/memtype.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
  

Patch

diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index c138ea0b0e6e..8c7f9e6b76e6 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -992,10 +992,9 @@  int track_pfn_copy(struct vm_area_struct *vma)
 		 * reserve the whole chunk covered by vma. We need the
 		 * starting address and protection from pte.
 		 */
-		if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
-			WARN_ON_ONCE(1);
+		if (follow_phys(vma, vma->vm_start, &prot, &paddr))
 			return -EINVAL;
-		}
+
 		pgprot = __pgprot(prot);
 		return reserve_pfn_range(paddr, vma_size, &pgprot, 1);
 	}
@@ -1079,10 +1078,8 @@  void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
 	/* free the chunk starting from pfn or the whole chunk */
 	paddr = (resource_size_t)pfn << PAGE_SHIFT;
 	if (!paddr && !size) {
-		if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
-			WARN_ON_ONCE(1);
+		if (follow_phys(vma, vma->vm_start, &prot, &paddr))
 			return;
-		}
 
 		size = vma->vm_end - vma->vm_start;
 	}