Hi folks, This patch is against a local copy of Greg's usb-2.5 tree and is for the ftdi_sio driver.
The patch frees the bulk write urb's transfer buffer in the write bulk callback (the buffer is allocated dynamically when the urb is submitted). The patch also tidies up the write bulk callback function a little bit - removing some unnecessary paranoid checks and scheduling a soft interrupt regardless of the port's open count (for consistency with other usb serial drivers). -- -=( Ian Abbott @ MEV Ltd. E-mail: <[EMAIL PROTECTED]> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
# This is a BitKeeper generated patch for the following project: # Project Name: greg k-h's linux 2.5 USB kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.2231 -> 1.2232 # drivers/usb/serial/ftdi_sio.c 1.56 -> 1.57 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/08/19 [EMAIL PROTECTED] 1.2232 # Freed urb's transfer buffer in write bulk callback (memory leak), and tidied up the write # bulk callback function a little bit to remove unnecessary paranoid checks and schedule work # regardless of the port's open count. # -------------------------------------------- # diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c --- a/drivers/usb/serial/ftdi_sio.c Tue Aug 19 12:26:50 2003 +++ b/drivers/usb/serial/ftdi_sio.c Tue Aug 19 12:26:50 2003 @@ -17,6 +17,11 @@ * See http://ftdi-usb-sio.sourceforge.net for upto date testing info * and extra documentation * + * (19/Aug/2003) Ian Abbott + * Freed urb's transfer buffer in write bulk callback. + * Omitted some paranoid checks in write bulk callback that don't matter. + * Scheduled work in write bulk callback regardless of port's open count. + * * (05/Aug/2003) Ian Abbott * Added VID/PID for ID TECH IDT1221U USB to RS-232 adapter. * VID/PID provided by Steve Briggs. @@ -1391,31 +1396,21 @@ static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; - struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); - dbg("%s", __FUNCTION__); + /* free up the transfer buffer, as usb_free_urb() does not do this */ + kfree (urb->transfer_buffer); if (port_paranoia_check (port, __FUNCTION__)) return; + dbg("%s - port %d", __FUNCTION__, port->number); + if (urb->status) { dbg("nonzero write bulk status received: %d", urb->status); return; } - if (!serial) { - dbg("%s - bad serial pointer, exiting", __FUNCTION__); - return; - } - - /* Have to check for validity of queueing up the tasks */ - dbg("%s - port->open_count = %d", __FUNCTION__, port->open_count); - - if (port->open_count > 0){ - schedule_work(&port->work); - } - - return; + schedule_work(&port->work); } /* ftdi_write_bulk_callback */