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>
This commit is contained in:
Hamish Martin 2018-05-14 13:32:22 +12:00 committed by Greg Kroah-Hartman
parent f59acbc5e0
commit 81daa406c2
1 changed files with 17 additions and 8 deletions

View File

@ -568,20 +568,29 @@ static ssize_t uio_write(struct file *filep, const char __user *buf,
ssize_t retval; ssize_t retval;
s32 irq_on; s32 irq_on;
if (!idev->info->irq) if (!idev->info->irq) {
return -EIO; retval = -EIO;
goto out;
}
if (count != sizeof(s32)) if (count != sizeof(s32)) {
return -EINVAL; retval = -EINVAL;
goto out;
}
if (!idev->info->irqcontrol) if (!idev->info->irqcontrol) {
return -ENOSYS; retval = -ENOSYS;
goto out;
}
if (copy_from_user(&irq_on, buf, count)) if (copy_from_user(&irq_on, buf, count)) {
return -EFAULT; retval = -EFAULT;
goto out;
}
retval = idev->info->irqcontrol(idev->info, irq_on); retval = idev->info->irqcontrol(idev->info, irq_on);
out:
return retval ? retval : sizeof(s32); return retval ? retval : sizeof(s32);
} }