Skip to contentSkip to conversation

drivers/usb/media/usbvideo.c: fix a check after use

PATCH Applied Adrian Bunk 3 participants 3 messages Mar 27, 2005 – Mar 28, 2005 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/usb/media/usbvideo.c: fix a check after use

This patch fixes a check after use found by the Coverity checker.

drivers/usb/media/usbvideo.c renamed from drivers/usb/media/usbvideo.c.old +3 -3
@@ -1814,12 +1814,12 @@
 {
 	int i, j;
 
-	if (uvd->debug > 1)
-		info("%s($%p)", __FUNCTION__, uvd);
-
 	if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL))
 		return;
 
+	if (uvd->debug > 1)
+		info("%s($%p)", __FUNCTION__, uvd);
+
 	/* Unschedule all of the iso td's */
 	for (i=0; i < USBVIDEO_NUMSBUF; i++) {
 		usb_kill_urb(uvd->sbuf[i].urb);
#1 lore raw

Hi Adrian,

Quoted 9 lines

This patch fixes a check after use found by the Coverity checker.

drivers/usb/media/usbvideo.c renamed from drivers/usb/media/usbvideo.c.old +0 -0
@@ -1814,12 +1814,12 @@
 {
 	int i, j;

drivers/usb/media/usbvideo.c line 1822

Quoted 10 lines
drivers/usb/media/usbvideo.c renamed from drivers/usb/media/usbvideo.c.old +3 -3
 
-	if (uvd->debug > 1)
-		info("%s($%p)", __FUNCTION__, uvd);
-
 	if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL))
 		return;
 
+	if (uvd->debug > 1)
+		info("%s($%p)", __FUNCTION__, uvd);
+

Note that you slightly change the debug trace when doing this. For example, the case where udv != NULL and !udv->streaming would display the debug line before your patch, and no more after.

Now I don't know whether that change is a problem or not in this particular case, as I am not the one who would debug this driver if there were a problem with it, but this is something to pay attention to in such cases.

Thanks,

Signature · 1 line
Jean Delvare