aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/airprime.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-19 15:59:04 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-19 15:59:04 -0500
commit460223d21d960e420775ca4d11ddaa8389af4d25 (patch)
treec1e9d3e661180263f5e4ac72af85a151d3c183e7 /drivers/usb/serial/airprime.c
parent255f0385c8e0d6b9005c0e09fffb5bd852f3b506 (diff)
parented077bb714816e942ea9b740156659a28a34112f (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (39 commits) USB: at91-ohci, handle extra at91sam9261 ahb clock USB: another id for cp2101 driver USB: ueagle-atm.c needs sched.h USB: at91_udc, shrink runtime footprint usbnet: add missing Kconfig for KC2190 cables usbnet: init fault (oops) cleanup, whitespace fixes usbnet: recognize SiteCom CN-124 usb: Remove Airprime device from option.c USB: change __init to __devinit for isp116x_probe USB: ps3: don't call ps3_system_bus_driver_register on other platforms USB: hid-core.c: Removes GTCO CalComp Interwrite IPanel PIDs from blacklist USB: kernel-doc fixes USB: quirky device for cdc-acm USB: cdc-acm: fix incorrect throtteling, make set_control optional USB: unconfigure devices which have config 0 USB: make usb_iso_packet_descriptor.status signed USB: fix g_serial small error USB: use __u32 rather than u32 in userspace ioctls in usbdevice_fs.h USB Storage: US_FL_IGNORE_RESIDUE needed for Aiptek MP3 Player USB: Fix misspelled "USBNET_MII" kernel config option. ...
Diffstat (limited to 'drivers/usb/serial/airprime.c')
-rw-r--r--drivers/usb/serial/airprime.c35
1 files changed, 8 insertions, 27 deletions
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index 0af42e32fa0a..18816bf96a4d 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -58,11 +58,6 @@ static void airprime_read_bulk_callback(struct urb *urb)
58 if (urb->status) { 58 if (urb->status) {
59 dbg("%s - nonzero read bulk status received: %d", 59 dbg("%s - nonzero read bulk status received: %d",
60 __FUNCTION__, urb->status); 60 __FUNCTION__, urb->status);
61 /* something happened, so free up the memory for this urb */
62 if (urb->transfer_buffer) {
63 kfree (urb->transfer_buffer);
64 urb->transfer_buffer = NULL;
65 }
66 return; 61 return;
67 } 62 }
68 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); 63 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
@@ -146,6 +141,8 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
146 airprime_read_bulk_callback, port); 141 airprime_read_bulk_callback, port);
147 result = usb_submit_urb(urb, GFP_KERNEL); 142 result = usb_submit_urb(urb, GFP_KERNEL);
148 if (result) { 143 if (result) {
144 usb_free_urb(urb);
145 kfree(buffer);
149 dev_err(&port->dev, 146 dev_err(&port->dev,
150 "%s - failed submitting read urb %d for port %d, error %d\n", 147 "%s - failed submitting read urb %d for port %d, error %d\n",
151 __FUNCTION__, i, port->number, result); 148 __FUNCTION__, i, port->number, result);
@@ -160,27 +157,12 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
160 /* some error happened, cancel any submitted urbs and clean up anything that 157 /* some error happened, cancel any submitted urbs and clean up anything that
161 got allocated successfully */ 158 got allocated successfully */
162 159
163 for ( ; i >= 0; --i) { 160 while (i-- != 0) {
164 urb = priv->read_urbp[i]; 161 urb = priv->read_urbp[i];
165 if (urb) { 162 buffer = urb->transfer_buffer;
166 /* This urb was submitted successfully. So we have to 163 usb_kill_urb (urb);
167 cancel it. 164 usb_free_urb (urb);
168 Unlinking the urb will invoke read_bulk_callback() 165 kfree (buffer);
169 with an error status, so its transfer buffer will
170 be freed there */
171 if (usb_unlink_urb (urb) != -EINPROGRESS) {
172 /* comments in drivers/usb/core/urb.c say this
173 can only happen if the urb was never submitted,
174 or has completed already.
175 Either way we may have to free the transfer
176 buffer here. */
177 if (urb->transfer_buffer) {
178 kfree (urb->transfer_buffer);
179 urb->transfer_buffer = NULL;
180 }
181 }
182 usb_free_urb (urb);
183 }
184 } 166 }
185 167
186 out: 168 out:
@@ -194,10 +176,9 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp)
194 176
195 dbg("%s - port %d", __FUNCTION__, port->number); 177 dbg("%s - port %d", __FUNCTION__, port->number);
196 178
197 /* killing the urb will invoke read_bulk_callback() with an error status,
198 so the transfer buffer will be freed there */
199 for (i = 0; i < NUM_READ_URBS; ++i) { 179 for (i = 0; i < NUM_READ_URBS; ++i) {
200 usb_kill_urb (priv->read_urbp[i]); 180 usb_kill_urb (priv->read_urbp[i]);
181 kfree (priv->read_urbp[i]->transfer_buffer);
201 usb_free_urb (priv->read_urbp[i]); 182 usb_free_urb (priv->read_urbp[i]);
202 } 183 }
203 184