aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usblcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/usblcd.c')
-rw-r--r--drivers/usb/misc/usblcd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 499d7508be9a..90aede90553e 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -74,10 +74,12 @@ static int lcd_open(struct inode *inode, struct file *file)
74 struct usb_interface *interface; 74 struct usb_interface *interface;
75 int subminor, r; 75 int subminor, r;
76 76
77 lock_kernel();
77 subminor = iminor(inode); 78 subminor = iminor(inode);
78 79
79 interface = usb_find_interface(&lcd_driver, subminor); 80 interface = usb_find_interface(&lcd_driver, subminor);
80 if (!interface) { 81 if (!interface) {
82 unlock_kernel();
81 err ("USBLCD: %s - error, can't find device for minor %d", 83 err ("USBLCD: %s - error, can't find device for minor %d",
82 __func__, subminor); 84 __func__, subminor);
83 return -ENODEV; 85 return -ENODEV;
@@ -87,6 +89,7 @@ static int lcd_open(struct inode *inode, struct file *file)
87 dev = usb_get_intfdata(interface); 89 dev = usb_get_intfdata(interface);
88 if (!dev) { 90 if (!dev) {
89 mutex_unlock(&open_disc_mutex); 91 mutex_unlock(&open_disc_mutex);
92 unlock_kernel();
90 return -ENODEV; 93 return -ENODEV;
91 } 94 }
92 95
@@ -98,11 +101,13 @@ static int lcd_open(struct inode *inode, struct file *file)
98 r = usb_autopm_get_interface(interface); 101 r = usb_autopm_get_interface(interface);
99 if (r < 0) { 102 if (r < 0) {
100 kref_put(&dev->kref, lcd_delete); 103 kref_put(&dev->kref, lcd_delete);
104 unlock_kernel();
101 return r; 105 return r;
102 } 106 }
103 107
104 /* save our object in the file's private structure */ 108 /* save our object in the file's private structure */
105 file->private_data = dev; 109 file->private_data = dev;
110 unlock_kernel();
106 111
107 return 0; 112 return 0;
108} 113}