mirror of https://github.com/torvalds/linux.git
binder_ioctl_write_read(): simplify control flow a bit
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
1812de14f0
commit
5a6acd563a
|
|
@ -5384,10 +5384,9 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
|
||||||
void __user *ubuf = (void __user *)arg;
|
void __user *ubuf = (void __user *)arg;
|
||||||
struct binder_write_read bwr;
|
struct binder_write_read bwr;
|
||||||
|
|
||||||
if (copy_from_user(&bwr, ubuf, sizeof(bwr))) {
|
if (copy_from_user(&bwr, ubuf, sizeof(bwr)))
|
||||||
ret = -EFAULT;
|
return -EFAULT;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
binder_debug(BINDER_DEBUG_READ_WRITE,
|
binder_debug(BINDER_DEBUG_READ_WRITE,
|
||||||
"%d:%d write %lld at %016llx, read %lld at %016llx\n",
|
"%d:%d write %lld at %016llx, read %lld at %016llx\n",
|
||||||
proc->pid, thread->pid,
|
proc->pid, thread->pid,
|
||||||
|
|
@ -5402,8 +5401,6 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
|
||||||
trace_binder_write_done(ret);
|
trace_binder_write_done(ret);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
bwr.read_consumed = 0;
|
bwr.read_consumed = 0;
|
||||||
if (copy_to_user(ubuf, &bwr, sizeof(bwr)))
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5417,22 +5414,17 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
|
||||||
if (!binder_worklist_empty_ilocked(&proc->todo))
|
if (!binder_worklist_empty_ilocked(&proc->todo))
|
||||||
binder_wakeup_proc_ilocked(proc);
|
binder_wakeup_proc_ilocked(proc);
|
||||||
binder_inner_proc_unlock(proc);
|
binder_inner_proc_unlock(proc);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
if (copy_to_user(ubuf, &bwr, sizeof(bwr)))
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
binder_debug(BINDER_DEBUG_READ_WRITE,
|
binder_debug(BINDER_DEBUG_READ_WRITE,
|
||||||
"%d:%d wrote %lld of %lld, read return %lld of %lld\n",
|
"%d:%d wrote %lld of %lld, read return %lld of %lld\n",
|
||||||
proc->pid, thread->pid,
|
proc->pid, thread->pid,
|
||||||
(u64)bwr.write_consumed, (u64)bwr.write_size,
|
(u64)bwr.write_consumed, (u64)bwr.write_size,
|
||||||
(u64)bwr.read_consumed, (u64)bwr.read_size);
|
(u64)bwr.read_consumed, (u64)bwr.read_size);
|
||||||
if (copy_to_user(ubuf, &bwr, sizeof(bwr))) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
out:
|
out:
|
||||||
|
if (copy_to_user(ubuf, &bwr, sizeof(bwr)))
|
||||||
|
ret = -EFAULT;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue