From 355e30ca1a707526b23a9b016fa4f740e9379c8d Mon Sep 17 00:00:00 2001
From: Alexander Gordeev <agordeev@linux.ibm.com>
Date: Sun, 2 Jul 2023 22:29:10 +0200
Subject: [PATCH] s390/mm: remove redundant check against VMEM_MAX_PHYS

The value of ident_map_size could never exceed the value of
vmemmap as secured by setup_kernel_memory_layout() function:

	/* make sure identity map doesn't overlay with vmemmap */
	ident_map_size = min(ident_map_size, vmemmap_start);

Since VMEM_MAX_PHYS macro is set to vmemmap and a newly added
range is checked against ident_map_size in add_memory_merged()
function anyway, the check against VMEM_MAX_PHYS is redundant.

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 drivers/s390/char/sclp_cmd.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 3c87057436d54..8b4575a0db9fb 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -392,10 +392,6 @@ static void __init add_memory_merged(u16 rn)
 		goto skip_add;
 	start = rn2addr(first_rn);
 	size = (unsigned long long) num * sclp.rzm;
-	if (start >= VMEM_MAX_PHYS)
-		goto skip_add;
-	if (start + size > VMEM_MAX_PHYS)
-		size = VMEM_MAX_PHYS - start;
 	if (start >= ident_map_size)
 		goto skip_add;
 	if (start + size > ident_map_size)
-- 
GitLab