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

Commit fc7f687a authored by Jonathan Corbet's avatar Jonathan Corbet
Browse files

fbmem: cdev lock_kernel() pushdown



Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 5794e1b1
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -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;
}