summaryrefslogtreecommitdiff
path: root/mm/shmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index fb7861108d31..d713239ce2ce 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2668,14 +2668,6 @@ put_memory:
}
EXPORT_SYMBOL_GPL(shmem_file_setup);
-void shmem_set_file(struct vm_area_struct *vma, struct file *file)
-{
- if (vma->vm_file)
- fput(vma->vm_file);
- vma->vm_file = file;
- vma->vm_ops = &shmem_vm_ops;
-}
-
/**
* shmem_zero_setup - setup a shared anonymous mapping
* @vma: the vma to be mmapped is prepared by do_mmap_pgoff
@@ -2688,8 +2680,11 @@ int shmem_zero_setup(struct vm_area_struct *vma)
file = shmem_file_setup("dev/zero", size, vma->vm_flags);
if (IS_ERR(file))
return PTR_ERR(file);
- shmem_set_file(vma, file);
+ if (vma->vm_file)
+ fput(vma->vm_file);
+ vma->vm_file = file;
+ vma->vm_ops = &shmem_vm_ops;
return 0;
}