diff options
author | Hamish Martin <hamish.martin@alliedtelesis.co.nz> | 2018-05-14 04:32:22 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-14 17:12:47 +0300 |
commit | 81daa406c2cc97d85eef9409400404efc2a3f756 (patch) | |
tree | 2a081b93fac8b59482bc6481ea9854f0db908227 /drivers/uio | |
parent | f59acbc5e0f7f90452efd4c3318d5e5ec042c3e0 (diff) | |
download | linux-81daa406c2cc97d85eef9409400404efc2a3f756.tar.xz |
uio: Reduce return paths from uio_write()
Drive all return paths for uio_write() through a single block at the
end of the function.
Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio')
-rw-r--r-- | drivers/uio/uio.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index d9235f30e46d..1883ce620ea9 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -568,20 +568,29 @@ static ssize_t uio_write(struct file *filep, const char __user *buf, ssize_t retval; s32 irq_on; - if (!idev->info->irq) - return -EIO; + if (!idev->info->irq) { + retval = -EIO; + goto out; + } - if (count != sizeof(s32)) - return -EINVAL; + if (count != sizeof(s32)) { + retval = -EINVAL; + goto out; + } - if (!idev->info->irqcontrol) - return -ENOSYS; + if (!idev->info->irqcontrol) { + retval = -ENOSYS; + goto out; + } - if (copy_from_user(&irq_on, buf, count)) - return -EFAULT; + if (copy_from_user(&irq_on, buf, count)) { + retval = -EFAULT; + goto out; + } retval = idev->info->irqcontrol(idev->info, irq_on); +out: return retval ? retval : sizeof(s32); } |