[2.6 patch] drivers/usb/core/devices.c: small corrections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Adrian Bunk <[email protected]>

--- linux-2.6.12-rc1-mm1-full/drivers/usb/core/devices.c.old	2005-03-22 21:13:18.000000000 +0100
+++ linux-2.6.12-rc1-mm1-full/drivers/usb/core/devices.c	2005-03-22 21:15:02.000000000 +0100
@@ -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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux