Skip to contentSkip to conversation

drivers/usb/core/devices.c: small corrections

PATCH Applied Adrian Bunk 2 participants 2 messages Mar 22, 2005 – Mar 24, 2005 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/usb/core/devices.c: small corrections

total_written is used at places where it can't have any value different from 0.

This patch is partially based on findings of the Coverity checker.

drivers/usb/core/devices.c renamed from drivers/usb/core/devices.c.old +2 -5
@@ -460,7 +460,7 @@ static ssize_t usb_device_dump(char __us
 		return 0;
 	
 	if (level > MAX_TOPO_LEVEL)
-		return total_written;
+		return 0;
 	/* allocate 2^1 pages = 8K (on i386); should be more than enough for one device */
         if (!(pages_start = (char*) __get_free_pages(GFP_KERNEL,1)))
                 return -ENOMEM;
@@ -527,10 +527,7 @@ static ssize_t usb_device_dump(char __us
 			length = *nbytes;
 		if (copy_to_user(*buffer, pages_start + *skip_bytes, length)) {
 			free_pages((unsigned long)pages_start, 1);
-			
-			if (total_written == 0)
-				return -EFAULT;
-			return total_written;
+			return -EFAULT;
 		}
 		*nbytes -= length;
 		*file_offset += length;
Applied
#1 lore raw
Quoted 6 lines · Adrian Bunk

total_written is used at places where it can't have any value different from 0.

This patch is partially based on findings of the Coverity checker.

Applied, thanks.

greg k-h