To: torvalds@transmeta.com
Cc: linux-usb-devel@lists.sourceforge.net
Subject: [PATCH 2 of 2] USB ov511 driver bugfix

Hi,

Here's a patch against 2.5.3-pre6 for the USB ov511 driver that fixes a
oops that would happen when ioctl() was called on the driver's proc
entry.  This patch was done by Mark McClelland.

thanks,

greg k-h



diff -Nru a/drivers/usb/ov511.c b/drivers/usb/ov511.c
--- a/drivers/usb/ov511.c	Tue Jan 29 13:27:27 2002
+++ b/drivers/usb/ov511.c	Tue Jan 29 13:27:27 2002
@@ -57,7 +57,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.48 for Linux 2.4"
+#define DRIVER_VERSION "v1.48a for Linux 2.4"
 #define EMAIL "mmcclell@bigfoot.com"
 #define DRIVER_AUTHOR "Mark McClelland <mmcclell@bigfoot.com> & Bret Wallach \
 	& Orion Sky Lawlor <olawlor@acm.org> & Kevin Moore & Charl P. Botha \
@@ -492,6 +492,10 @@
 static struct proc_dir_entry *ov511_proc_entry = NULL;
 extern struct proc_dir_entry *video_proc_entry;
 
+static struct file_operations ov511_control_fops = {
+	ioctl:		ov511_control_ioctl,
+};
+
 #define YES_NO(x) ((x) ? "yes" : "no")
 
 /* /proc/video/ov511/<minor#>/info */
@@ -673,8 +677,8 @@
 		unlock_kernel();
 		return;
 	}
-	ov511->proc_control->proc_fops->ioctl = ov511_control_ioctl;
 	ov511->proc_control->data = ov511;
+	ov511->proc_control->proc_fops = &ov511_control_fops;
 	unlock_kernel();
 }
 
@@ -6893,13 +6897,13 @@
 		}
 	}
 
-	usb_driver_release_interface(&ov511_driver,
-		&ov511->dev->actconfig->interface[ov511->iface]);
-	ov511->dev = NULL;
-
 #if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS)
         destroy_proc_ov511_cam(ov511);
 #endif
+
+	usb_driver_release_interface(&ov511_driver,
+		&ov511->dev->actconfig->interface[ov511->iface]);
+	ov511->dev = NULL;
 
 	/* Free the memory */
 	if (ov511 && !ov511->user) {

