PERFORCE change 157137 for review

Hans Petter Selasky hselasky at FreeBSD.org
Wed Feb 4 05:51:48 PST 2009


http://perforce.freebsd.org/chv.cgi?CH=157137

Change 157137 by hselasky at hselasky_laptop001 on 2009/02/04 13:50:49

	
	USB ethernet patch:
	- Make function definition match prototype.
	- Clear control request destination buffer in all error cases.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/ethernet/usb2_ethernet.c#9 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/ethernet/usb2_ethernet.c#9 (text+ko) ====

@@ -315,21 +315,25 @@
 usb2_error_t
 usb2_ether_do_request(struct usb2_ether *ue, 
     struct usb2_device_request *req, void *data, 
-    uint32_t timeout)
+    unsigned int timeout)
 {
 	uint16_t len;
 	usb2_error_t err;
 
+	/* get request data length */
+	len = UGETW(req->wLength);
+
 	/* check if the device is being detached */
-	if (usb2_proc_is_gone(&ue->ue_tq))
-		return (USB_ERR_IOERROR);
+	if (usb2_proc_is_gone(&ue->ue_tq)) {
+		err = USB_ERR_IOERROR;
+		goto done;
+	}
 
-	len = UGETW(req->wLength);
-
 	/* do the USB request */
 	err = usb2_do_request_flags(ue->ue_udev, ue->ue_mtx, 
 	    req, data, 0, NULL, timeout);
 
+done:
 	/* on failure we zero the data */
 	if (err && len && (req->bmRequestType & UE_DIR_IN))
 		memset(data, 0, len);


More information about the p4-projects mailing list