<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">ChangeSet 1.1825, 2004/06/22 09:20:30-07:00, greg@kroah.com

[PATCH] USB: sparse fixups for devio.c


 drivers/usb/core/devio.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)


diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c	Tue Jun 22 09:46:22 2004
+++ b/drivers/usb/core/devio.c	Tue Jun 22 09:46:22 2004
@@ -290,8 +290,11 @@
 		spin_lock_irqsave(&amp;ps-&gt;lock, flags);
 	}
 	spin_unlock_irqrestore(&amp;ps-&gt;lock, flags);
-	while ((as = async_getcompleted(ps)))
+	as = async_getcompleted(ps);
+	while (as) {
 		free_async(as);
+		as = async_getcompleted(ps);
+	}
 }
 
 static void destroy_async_on_interface (struct dev_state *ps, unsigned int ifnum)
@@ -968,29 +971,27 @@
 static int processcompl(struct async *as)
 {
 	struct urb *urb = as-&gt;urb;
+	struct usbdevfs_urb __user *userurb = as-&gt;userurb;
 	unsigned int i;
 
 	if (as-&gt;userbuffer)
 		if (copy_to_user(as-&gt;userbuffer, urb-&gt;transfer_buffer, urb-&gt;transfer_buffer_length))
 			return -EFAULT;
-	if (put_user(urb-&gt;status,
-		     &amp;((struct usbdevfs_urb *)as-&gt;userurb)-&gt;status))
+	if (put_user(urb-&gt;status, &amp;userurb-&gt;status))
 		return -EFAULT;
-	if (put_user(urb-&gt;actual_length,
-		     &amp;((struct usbdevfs_urb *)as-&gt;userurb)-&gt;actual_length))
+	if (put_user(urb-&gt;actual_length, &amp;userurb-&gt;actual_length))
 		return -EFAULT;
-	if (put_user(urb-&gt;error_count,
-		     &amp;((struct usbdevfs_urb *)as-&gt;userurb)-&gt;error_count))
+	if (put_user(urb-&gt;error_count, &amp;userurb-&gt;error_count))
 		return -EFAULT;
 
 	if (!(usb_pipeisoc(urb-&gt;pipe)))
 		return 0;
 	for (i = 0; i &lt; urb-&gt;number_of_packets; i++) {
 		if (put_user(urb-&gt;iso_frame_desc[i].actual_length,
-			     &amp;((struct usbdevfs_urb *)as-&gt;userurb)-&gt;iso_frame_desc[i].actual_length))
+			     &amp;userurb-&gt;iso_frame_desc[i].actual_length))
 			return -EFAULT;
 		if (put_user(urb-&gt;iso_frame_desc[i].status,
-			     &amp;((struct usbdevfs_urb *)as-&gt;userurb)-&gt;iso_frame_desc[i].status))
+			     &amp;userurb-&gt;iso_frame_desc[i].status))
 			return -EFAULT;
 	}
 	return 0;
</pre></body></html>