Skip to content

Commit 2a3809d

Browse files
Liu Shixingregkh
authored andcommitted
binder: simplify the return expression of binder_mmap
Simplify the return expression. Acked-by: Martijn Coenen <[email protected]> Acked-by: Christian Brauner <[email protected]> Signed-off-by: Liu Shixin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5d90e05 commit 2a3809d

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

drivers/android/binder.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5180,9 +5180,7 @@ static const struct vm_operations_struct binder_vm_ops = {
51805180

51815181
static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
51825182
{
5183-
int ret;
51845183
struct binder_proc *proc = filp->private_data;
5185-
const char *failure_string;
51865184

51875185
if (proc->tsk != current->group_leader)
51885186
return -EINVAL;
@@ -5194,25 +5192,17 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
51945192
(unsigned long)pgprot_val(vma->vm_page_prot));
51955193

51965194
if (vma->vm_flags & FORBIDDEN_MMAP_FLAGS) {
5197-
ret = -EPERM;
5198-
failure_string = "bad vm_flags";
5199-
goto err_bad_arg;
5195+
pr_err("%s: %d %lx-%lx %s failed %d\n", __func__,
5196+
proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM);
5197+
return -EPERM;
52005198
}
52015199
vma->vm_flags |= VM_DONTCOPY | VM_MIXEDMAP;
52025200
vma->vm_flags &= ~VM_MAYWRITE;
52035201

52045202
vma->vm_ops = &binder_vm_ops;
52055203
vma->vm_private_data = proc;
52065204

5207-
ret = binder_alloc_mmap_handler(&proc->alloc, vma);
5208-
if (ret)
5209-
return ret;
5210-
return 0;
5211-
5212-
err_bad_arg:
5213-
pr_err("%s: %d %lx-%lx %s failed %d\n", __func__,
5214-
proc->pid, vma->vm_start, vma->vm_end, failure_string, ret);
5215-
return ret;
5205+
return binder_alloc_mmap_handler(&proc->alloc, vma);
52165206
}
52175207

52185208
static int binder_open(struct inode *nodp, struct file *filp)

0 commit comments

Comments
 (0)