mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
binder: simplify the return expression of binder_mmap
Simplify the return expression. Acked-by: Martijn Coenen <maco@android.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Liu Shixin <liushixin2@huawei.com> Link: https://lore.kernel.org/r/20200929015216.1829946-1-liushixin2@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5d90e05c0e
commit
2a3809da61
@@ -5180,9 +5180,7 @@ static const struct vm_operations_struct binder_vm_ops = {
|
|||||||
|
|
||||||
static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
|
static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
struct binder_proc *proc = filp->private_data;
|
struct binder_proc *proc = filp->private_data;
|
||||||
const char *failure_string;
|
|
||||||
|
|
||||||
if (proc->tsk != current->group_leader)
|
if (proc->tsk != current->group_leader)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -5194,9 +5192,9 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
|
|||||||
(unsigned long)pgprot_val(vma->vm_page_prot));
|
(unsigned long)pgprot_val(vma->vm_page_prot));
|
||||||
|
|
||||||
if (vma->vm_flags & FORBIDDEN_MMAP_FLAGS) {
|
if (vma->vm_flags & FORBIDDEN_MMAP_FLAGS) {
|
||||||
ret = -EPERM;
|
pr_err("%s: %d %lx-%lx %s failed %d\n", __func__,
|
||||||
failure_string = "bad vm_flags";
|
proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM);
|
||||||
goto err_bad_arg;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
vma->vm_flags |= VM_DONTCOPY | VM_MIXEDMAP;
|
vma->vm_flags |= VM_DONTCOPY | VM_MIXEDMAP;
|
||||||
vma->vm_flags &= ~VM_MAYWRITE;
|
vma->vm_flags &= ~VM_MAYWRITE;
|
||||||
@@ -5204,15 +5202,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
|
|||||||
vma->vm_ops = &binder_vm_ops;
|
vma->vm_ops = &binder_vm_ops;
|
||||||
vma->vm_private_data = proc;
|
vma->vm_private_data = proc;
|
||||||
|
|
||||||
ret = binder_alloc_mmap_handler(&proc->alloc, vma);
|
return binder_alloc_mmap_handler(&proc->alloc, vma);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
err_bad_arg:
|
|
||||||
pr_err("%s: %d %lx-%lx %s failed %d\n", __func__,
|
|
||||||
proc->pid, vma->vm_start, vma->vm_end, failure_string, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int binder_open(struct inode *nodp, struct file *filp)
|
static int binder_open(struct inode *nodp, struct file *filp)
|
||||||
|
Reference in New Issue
Block a user