diff mbox

drivers/media/video: avoid NULL dereference

Message ID Pine.LNX.4.64.1003212230380.12371@ask.diku.dk (mailing list archive)
State Superseded
Headers show

Commit Message

Julia Lawall March 21, 2010, 9:31 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c
index e0bce8d..2357218 100644
--- a/drivers/media/video/ov511.c
+++ b/drivers/media/video/ov511.c
@@ -5913,14 +5913,12 @@  ov51x_disconnect(struct usb_interface *intf)
 
 	PDEBUG(3, "");
 
+	if (!ov)
+		return;
+
 	mutex_lock(&ov->lock);
 	usb_set_intfdata (intf, NULL);
 
-	if (!ov) {
-		mutex_unlock(&ov->lock);
-		return;
-	}
-
 	/* Free device number */
 	ov511_devused &= ~(1 << ov->nr);