summary refs log tree commit diff
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorWill Deacon <will@kernel.org>2021-01-14 15:42:14 +0000
committerWill Deacon <will@kernel.org>2021-01-21 12:50:18 +0000
commit8c63ca5bc3e19f11128e8e285dcf20aac6768f97 (patch)
tree49a45f35182ff79bca8132b5e8c432b5b703ac00 /mm/swapfile.c
parent2b635dd372f6c8f27644c662bb48d10376ce561a (diff)
downloadlinux-8c63ca5bc3e19f11128e8e285dcf20aac6768f97.tar.gz
mm: Use static initialisers for immutable fields of 'struct vm_fault'
In preparation for const-ifying the anonymous struct field of
'struct vm_fault', ensure that it is initialised using designated
initialisers.

Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 9fffc5af29d1..2b570a566276 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1951,8 +1951,6 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
 	si = swap_info[type];
 	pte = pte_offset_map(pmd, addr);
 	do {
-		struct vm_fault vmf;
-
 		if (!is_swap_pte(*pte))
 			continue;
 
@@ -1968,9 +1966,12 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
 		swap_map = &si->swap_map[offset];
 		page = lookup_swap_cache(entry, vma, addr);
 		if (!page) {
-			vmf.vma = vma;
-			vmf.address = addr;
-			vmf.pmd = pmd;
+			struct vm_fault vmf = {
+				.vma = vma,
+				.address = addr,
+				.pmd = pmd,
+			};
+
 			page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE,
 						&vmf);
 		}