From 1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 18 Apr 2005 17:39:34 -0700 Subject: [PATCH] USB: kfree cleanup for drivers/usb/* - no need to check for NULL Get rid of a bunch of redundant NULL pointer checks in drivers/usb/*, there's no need to check a pointer for NULL before calling kfree() on it. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman Index: gregkh-2.6/drivers/usb/class/audio.c =================================================================== --- drivers/usb/serial/io_edgeport.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'drivers/usb/serial/io_edgeport.c') diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index e35b5adcd5f..04bfe279d76 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -951,9 +951,7 @@ static void edge_bulk_out_cmd_callback (struct urb *urb, struct pt_regs *regs) /* clean up the transfer buffer */ - if (urb->transfer_buffer != NULL) { - kfree(urb->transfer_buffer); - } + kfree(urb->transfer_buffer); /* Free the command urb */ usb_free_urb (urb); @@ -1266,16 +1264,12 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) if (edge_port->write_urb) { /* if this urb had a transfer buffer already (old transfer) free it */ - if (edge_port->write_urb->transfer_buffer != NULL) { - kfree(edge_port->write_urb->transfer_buffer); - } - usb_free_urb (edge_port->write_urb); + kfree(edge_port->write_urb->transfer_buffer); + usb_free_urb(edge_port->write_urb); edge_port->write_urb = NULL; } - if (edge_port->txfifo.fifo) { - kfree(edge_port->txfifo.fifo); - edge_port->txfifo.fifo = NULL; - } + kfree(edge_port->txfifo.fifo); + edge_port->txfifo.fifo = NULL; dbg("%s exited", __FUNCTION__); } @@ -1419,11 +1413,9 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge // get a pointer to the write_urb urb = edge_port->write_urb; - /* if this urb had a transfer buffer already (old transfer) free it */ - if (urb->transfer_buffer != NULL) { - kfree(urb->transfer_buffer); - urb->transfer_buffer = NULL; - } + /* make sure transfer buffer is freed */ + kfree(urb->transfer_buffer); + urb->transfer_buffer = NULL; /* build the data header for the buffer and port that we are about to send out */ count = fifo->count; -- cgit v1.2.3-70-g09d2