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

Commit f9c8154f authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jonathan Corbet
Browse files

mousedev: BKL pushdown



Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent dca67e9d
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#define MOUSEDEV_MIX		31

#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/poll.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -545,16 +546,21 @@ static int mousedev_open(struct inode *inode, struct file *file)
	if (i >= MOUSEDEV_MINORS)
		return -ENODEV;

	lock_kernel();
	error = mutex_lock_interruptible(&mousedev_table_mutex);
	if (error)
	if (error) {
		unlock_kernel();
		return error;
	}
	mousedev = mousedev_table[i];
	if (mousedev)
		get_device(&mousedev->dev);
	mutex_unlock(&mousedev_table_mutex);

	if (!mousedev)
	if (!mousedev) {
		unlock_kernel();
		return -ENODEV;
	}

	client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL);
	if (!client) {
@@ -573,6 +579,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
		goto err_free_client;

	file->private_data = client;
	unlock_kernel();
	return 0;

 err_free_client:
@@ -580,6 +587,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
	kfree(client);
 err_put_mousedev:
	put_device(&mousedev->dev);
	unlock_kernel();
	return error;
}