Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd4fe633 authored by Hamish Martin's avatar Hamish Martin Committed by Greg Kroah-Hartman
Browse files

uio: Reduce return paths from uio_write()



commit 81daa406 upstream.

Drive all return paths for uio_write() through a single block at the
end of the function.

Signed-off-by: default avatarHamish Martin <hamish.martin@alliedtelesis.co.nz>
Reviewed-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarTommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 943f5f2a
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -570,20 +570,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);
}