[cpia] [patch] cpia_usb.c for 2.3.99-pre8
Randy Dunlap
randy.dunlap@intel.com
Fri, 12 May 2000 16:51:14 -0700
This is a multi-part message in MIME format.
--------------A4C208E580129D8B8D05690D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
I'd like to propose this patch to cpia_usb.c for 2.3.99-pre8.
It corrects one printk() string and makes
cpia_usb_open() honor error returns from
usb_submit_urb(). This is important for USB bandwidth
allocation/management.
Thanks,
Randy
--
___________________________________________________
|Randy Dunlap Intel Corp., DAL Sr. SW Engr.|
|randy.dunlap.at.intel.com 503-696-2055|
|NOTE: Any views presented here are mine alone |
|and may not represent the views of my employer. |
|_________________________________________________|
--------------A4C208E580129D8B8D05690D
Content-Type: text/plain; charset=us-ascii;
name="cpia_usb.diff"
Content-Disposition: inline;
filename="cpia_usb.diff"
Content-Transfer-Encoding: 7bit
--- cpia_usb.c.org Thu Mar 30 18:00:01 2000
+++ cpia_usb.c Thu May 11 17:20:53 2000
@@ -186,7 +186,7 @@
if (ret < 0) {
printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret);
retval = -EBUSY;
- goto error_all;
+ goto error_1;
}
ucpia->buffers[0]->status = FRAME_EMPTY;
@@ -203,7 +203,7 @@
if (!urb) {
printk(KERN_ERR "cpia_init_isoc: usb_alloc_urb 0\n");
retval = -ENOMEM;
- goto error_all;
+ goto error_1;
}
ucpia->sbuf[0].urb = urb;
@@ -222,9 +222,9 @@
urb = usb_alloc_urb(FRAMES_PER_DESC);
if (!urb) {
- printk(KERN_ERR "cpia_init_isoc: usb_alloc_urb 0\n");
+ printk(KERN_ERR "cpia_init_isoc: usb_alloc_urb 1\n");
retval = -ENOMEM;
- goto error_all;
+ goto error_urb0;
}
ucpia->sbuf[1].urb = urb;
@@ -245,20 +245,30 @@
ucpia->sbuf[0].urb->next = ucpia->sbuf[1].urb;
err = usb_submit_urb(ucpia->sbuf[0].urb);
- if (err)
+ if (err) {
printk(KERN_ERR "cpia_init_isoc: usb_submit_urb 0 ret %d\n",
err);
+ goto error_urb1;
+ }
err = usb_submit_urb(ucpia->sbuf[1].urb);
- if (err)
+ if (err) {
printk(KERN_ERR "cpia_init_isoc: usb_submit_urb 1 ret %d\n",
err);
+ goto error_urb1;
+ }
ucpia->streaming = 1;
ucpia->open = 1;
return 0;
-error_all:
+error_urb1: /* free urb 1 */
+ usb_free_urb(ucpia->sbuf[1].urb);
+
+error_urb0: /* free urb 0 */
+ usb_free_urb(ucpia->sbuf[0].urb);
+
+error_1:
kfree (ucpia->sbuf[1].data);
error_0:
kfree (ucpia->sbuf[0].data);
--------------A4C208E580129D8B8D05690D--