patch-2.4.0-test2 linux/drivers/telephony/phonedev.c

Next file: linux/drivers/usb/Config.in
Previous file: linux/drivers/telephony/ixj.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/drivers/telephony/phonedev.c linux/drivers/telephony/phonedev.c
@@ -49,6 +49,7 @@
 	unsigned int minor = MINOR(inode->i_rdev);
 	int err = 0;
 	struct phone_device *p;
+	struct file_operations *old_fops;
 
 	if (minor >= PHONE_NUM_DEVICES)
 		return -ENODEV;
@@ -69,12 +70,15 @@
 			goto end;
 		}
 	}
-	if (p->open) {
+	old_fops = file->f_op;
+	file->f_op = fops_get(p->f_op);
+	if (p->open)
 		err = p->open(p, file);	/* Tell the device it is open */
-		if (err)
-			goto end;
+	if (err) {
+		fops_put(file->f_op);
+		file->f_op = fops_get(old_fops);
 	}
-	file->f_op = p->f_op;
+	fops_put(old_fops);
 end:
 	up(&phone_lock);
 	return err;
@@ -129,6 +133,7 @@
 
 static struct file_operations phone_fops =
 {
+	owner:		THIS_MODULE,
 	open:		phone_open,
 };
 

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