]> err.no Git - linux-2.6/commitdiff
fbmem: cdev lock_kernel() pushdown
authorJonathan Corbet <corbet@lwn.net>
Thu, 15 May 2008 22:30:36 +0000 (16:30 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:05:50 +0000 (14:05 -0600)
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
drivers/video/fbmem.c

index 776f7fcd2fbf4f508a0bb72398391aeb8f5a32d0..33ebdb198dafbf5776ff5a5ac4a39c35fecf1464 100644 (file)
@@ -1326,20 +1326,27 @@ fb_open(struct inode *inode, struct file *file)
 
        if (fbidx >= FB_MAX)
                return -ENODEV;
+       lock_kernel();
 #ifdef CONFIG_KMOD
        if (!(info = registered_fb[fbidx]))
                try_to_load(fbidx);
 #endif /* CONFIG_KMOD */
-       if (!(info = registered_fb[fbidx]))
-               return -ENODEV;
-       if (!try_module_get(info->fbops->owner))
-               return -ENODEV;
+       if (!(info = registered_fb[fbidx])) {
+               res = -ENODEV;
+               goto out;
+       }
+       if (!try_module_get(info->fbops->owner)) {
+               res = -ENODEV;
+               goto out;
+       }
        file->private_data = info;
        if (info->fbops->fb_open) {
                res = info->fbops->fb_open(info,1);
                if (res)
                        module_put(info->fbops->owner);
        }
+out:
+       unlock_kernel();
        return res;
 }