Commit 5ed0505c authored by Damian Hobson-Garcia's avatar Damian Hobson-Garcia Committed by Greg Kroah-Hartman

drivers: uio: Fix UIO device registration failure

Until recently uio_get_minor() returned 0 for success and
a negative value on failure.  This became non-negative for suceess and
negative for failure.  Restore the original return value spec so that we can
successfully initialize UIO devices with a non-zero minor device
number.

Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: default avatarDamian Hobson-Garcia <dhobsong@igel.co.jp>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7f4f2302
...@@ -374,6 +374,7 @@ static int uio_get_minor(struct uio_device *idev) ...@@ -374,6 +374,7 @@ static int uio_get_minor(struct uio_device *idev)
retval = idr_alloc(&uio_idr, idev, 0, UIO_MAX_DEVICES, GFP_KERNEL); retval = idr_alloc(&uio_idr, idev, 0, UIO_MAX_DEVICES, GFP_KERNEL);
if (retval >= 0) { if (retval >= 0) {
idev->minor = retval; idev->minor = retval;
retval = 0;
} else if (retval == -ENOSPC) { } else if (retval == -ENOSPC) {
dev_err(idev->dev, "too many uio devices\n"); dev_err(idev->dev, "too many uio devices\n");
retval = -EINVAL; retval = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment