Skip to contentSkip to conversation

lib/test_hmm: Remove set but unused page variable

PATCH In review Alistair Popple 2 participants 2 messages Jul 6, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/test_hmm: Remove set but unused page variable

The HMM selftests use atomic_check_access() to check atomic access to a page has been revoked. It doesn't matter if the page mapping has been removed from the mirrored page tables as that also implies atomic access has been revoked. Therefore remove the unused page variable to fix this compiler warning:

lib/test_hmm.c:631:16: warning: variable ‘page’ set but not used [-Wunused-but-set-variable]

Fixes b659baea7546 ("mm: selftests for exclusive device memory")
---
 lib/test_hmm.c | 2 --
 1 file changed, 2 deletions(-)
lib/test_hmm.c +0 -2
index 8c55c4723692..c259842f6d44 100644
@@ -628,10 +628,8 @@ static int dmirror_check_atomic(struct dmirror *dmirror, unsigned long start,
 
 	for (pfn = start >> PAGE_SHIFT; pfn < (end >> PAGE_SHIFT); pfn++) {
 		void *entry;
-		struct page *page;
 
 		entry = xa_load(&dmirror->pt, pfn);
-		page = xa_untag_pointer(entry);
 		if (xa_pointer_tag(entry) == DPT_XA_TAG_ATOMIC)
 			return -EPERM;
 	}
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Alistair Popple

The HMM selftests use atomic_check_access() to check atomic access to a page has been revoked. It doesn't matter if the page mapping has been removed from the mirrored page tables as that also implies atomic access has been revoked. Therefore remove the unused page variable to fix this compiler warning:

Quoted 7 lines

lib/test_hmm.c:631:16: warning: variable ‘page’ set but not used [-Wunused-but-set-variable]

Fixes b659baea7546 ("mm: selftests for exclusive device memory")
Quoted 23 lines
---
 lib/test_hmm.c | 2 --
 1 file changed, 2 deletions(-)
lib/test_hmm.c +0 -3
index 8c55c4723692..c259842f6d44 100644
@@ -628,10 +628,8 @@ static int dmirror_check_atomic(struct dmirror *dmirror, unsigned long start,
 
        for (pfn = start >> PAGE_SHIFT; pfn < (end >> PAGE_SHIFT); pfn++) {
                void *entry;
-               struct page *page;
 
                entry = xa_load(&dmirror->pt, pfn);
-               page = xa_untag_pointer(entry);
                if (xa_pointer_tag(entry) == DPT_XA_TAG_ATOMIC)
                        return -EPERM;
        }
--

2.20.1