]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
UIO: cdev lock_kernel() pushdown
authorJonathan Corbet <corbet@lwn.net>
Thu, 15 May 2008 16:39:37 +0000 (10:39 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:05:47 +0000 (14:05 -0600)
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
drivers/uio/uio.c

index 55cc7b80422a0617dab71e8adbf34c9d854cc5ac..1a0415e77a3053facfe5b5263babc0ad94d72c04 100644 (file)
@@ -297,12 +297,17 @@ static int uio_open(struct inode *inode, struct file *filep)
        struct uio_listener *listener;
        int ret = 0;
 
+       lock_kernel();
        idev = idr_find(&uio_idr, iminor(inode));
-       if (!idev)
-               return -ENODEV;
+       if (!idev) {
+               ret = -ENODEV;
+               goto out;
+       }
 
-       if (!try_module_get(idev->owner))
-               return -ENODEV;
+       if (!try_module_get(idev->owner)) {
+               ret = -ENODEV;
+               goto out;
+       }
 
        listener = kmalloc(sizeof(*listener), GFP_KERNEL);
        if (!listener) {
@@ -319,7 +324,7 @@ static int uio_open(struct inode *inode, struct file *filep)
                if (ret)
                        goto err_infoopen;
        }
-
+       unlock_kernel();
        return 0;
 
 err_infoopen:
@@ -329,6 +334,8 @@ err_alloc_listener:
 
        module_put(idev->owner);
 
+out:
+       unlock_kernel();
        return ret;
 }