drivers: uio: Fix UIO device registration failure
authorDamian Hobson-Garcia <dhobsong@igel.co.jp>
Tue, 26 Mar 2013 01:31:22 +0000 (10:31 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Mar 2013 16:08:22 +0000 (09:08 -0700)
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: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio.c

index c8b926291e284b3aa3c1bda010b20178071c5368..b645c47501b42cc4765073fa6a5d2d2bfaf60396 100644 (file)
@@ -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);
        if (retval >= 0) {
                idev->minor = retval;
+               retval = 0;
        } else if (retval == -ENOSPC) {
                dev_err(idev->dev, "too many uio devices\n");
                retval = -EINVAL;