patch-2.4.0-test5 linux/drivers/usb/input.c

Next file: linux/drivers/usb/microtek.c
Previous file: linux/drivers/usb/ibmcam.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test4/linux/drivers/usb/input.c linux/drivers/usb/input.c
@@ -360,15 +360,24 @@
 static int input_open_file(struct inode *inode, struct file *file)
 {
 	struct input_handler *handler = input_table[MINOR(inode->i_rdev) >> 5];
-	struct file_operations *old_fops;
+	struct file_operations *old_fops, *new_fops = NULL;
 	int err;
 
-	if (!handler || !handler->fops || !handler->fops->open)
+	/* No load-on-demand here? */
+	if (!handler || !(new_fops = fops_get(handler->fops)))
 		return -ENODEV;
 
+	/*
+	 * That's _really_ odd. Usually NULL ->open means "nothing special",
+	 * not "no device". Oh, well...
+	 */
+	if (!new_fops->open) {
+		fops_put(new_fops);
+		return -ENODEV;
+	}
 	old_fops = file->f_op;
-	file->f_op = fops_get(handler->fops);
-	err = handler->fops->open(inode, file);
+	file->f_op = new_fops;
+	err = new_fops->open(inode, file);
 	if (err) {
 		fops_put(file->f_op);
 		file->f_op = fops_get(old_fops);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)