ashmem: Add shmem_set_file to mm/shmem.c
[firefly-linux-kernel-4.4.55.git] / drivers / staging / android / ashmem.c
index 3f2a3d611e4bea033b7943085f4fef747112be89..ae0166ff667fd60e8cfa7b4773e0817b53af41a8 100644 (file)
@@ -396,22 +396,14 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
        }
        get_file(asma->file);
 
-       /*
-        * XXX - Reworked to use shmem_zero_setup() instead of
-        * shmem_set_file while we're in staging. -jstultz
-        */
-       if (vma->vm_flags & VM_SHARED) {
-               ret = shmem_zero_setup(vma);
-               if (ret) {
-                       fput(asma->file);
-                       goto out;
-               }
+       if (vma->vm_flags & VM_SHARED)
+               shmem_set_file(vma, asma->file);
+       else {
+               if (vma->vm_file)
+                       fput(vma->vm_file);
+               vma->vm_file = asma->file;
        }
 
-       if (vma->vm_file)
-               fput(vma->vm_file);
-       vma->vm_file = asma->file;
-
 out:
        mutex_unlock(&ashmem_mutex);
        return ret;