}
}
set_current_state(TASK_RUNNING);
- if (u->durb[0].urb->transfer_buffer)
- kfree(u->durb[0].urb->transfer_buffer);
- if (u->durb[1].urb->transfer_buffer)
- kfree(u->durb[1].urb->transfer_buffer);
- if (u->surb[0].urb->transfer_buffer)
- kfree(u->surb[0].urb->transfer_buffer);
- if (u->surb[1].urb->transfer_buffer)
- kfree(u->surb[1].urb->transfer_buffer);
+ kfree(u->durb[0].urb->transfer_buffer);
+ kfree(u->durb[1].urb->transfer_buffer);
+ kfree(u->surb[0].urb->transfer_buffer);
+ kfree(u->surb[1].urb->transfer_buffer);
u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer =
u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL;
}
u->phase = 0;
maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
bufsz = DESCFRAMES * maxsze;
- if (u->durb[0].urb->transfer_buffer)
- kfree(u->durb[0].urb->transfer_buffer);
+ kfree(u->durb[0].urb->transfer_buffer);
u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
u->durb[0].urb->transfer_buffer_length = bufsz;
- if (u->durb[1].urb->transfer_buffer)
- kfree(u->durb[1].urb->transfer_buffer);
+ kfree(u->durb[1].urb->transfer_buffer);
u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
u->durb[1].urb->transfer_buffer_length = bufsz;
if (u->syncpipe) {
- if (u->surb[0].urb->transfer_buffer)
- kfree(u->surb[0].urb->transfer_buffer);
+ kfree(u->surb[0].urb->transfer_buffer);
u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES;
- if (u->surb[1].urb->transfer_buffer)
- kfree(u->surb[1].urb->transfer_buffer);
+ kfree(u->surb[1].urb->transfer_buffer);
u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES;
}
}
}
set_current_state(TASK_RUNNING);
- if (u->durb[0].urb->transfer_buffer)
- kfree(u->durb[0].urb->transfer_buffer);
- if (u->durb[1].urb->transfer_buffer)
- kfree(u->durb[1].urb->transfer_buffer);
- if (u->surb[0].urb->transfer_buffer)
- kfree(u->surb[0].urb->transfer_buffer);
- if (u->surb[1].urb->transfer_buffer)
- kfree(u->surb[1].urb->transfer_buffer);
+ kfree(u->durb[0].urb->transfer_buffer);
+ kfree(u->durb[1].urb->transfer_buffer);
+ kfree(u->surb[0].urb->transfer_buffer);
+ kfree(u->surb[1].urb->transfer_buffer);
u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer =
u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL;
}
u->phase = 0;
maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
bufsz = DESCFRAMES * maxsze;
- if (u->durb[0].urb->transfer_buffer)
- kfree(u->durb[0].urb->transfer_buffer);
+ kfree(u->durb[0].urb->transfer_buffer);
u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
u->durb[0].urb->transfer_buffer_length = bufsz;
- if (u->durb[1].urb->transfer_buffer)
- kfree(u->durb[1].urb->transfer_buffer);
+ kfree(u->durb[1].urb->transfer_buffer);
u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
u->durb[1].urb->transfer_buffer_length = bufsz;
if (u->syncpipe) {
- if (u->surb[0].urb->transfer_buffer)
- kfree(u->surb[0].urb->transfer_buffer);
+ kfree(u->surb[0].urb->transfer_buffer);
u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES;
- if (u->surb[1].urb->transfer_buffer)
- kfree(u->surb[1].urb->transfer_buffer);
+ kfree(u->surb[1].urb->transfer_buffer);
u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES;
}
}
}
if (urb->transfer_buffer_length < len) {
- kfree (urb->transfer_buffer);
+ kfree(urb->transfer_buffer);
urb->transfer_buffer = kmalloc (len, GFP_KERNEL);
if (urb->transfer_buffer == NULL) {
err ("%s - out of memory", __FUNCTION__);
}
exit:
- kfree (temp_buffer);
+ kfree(temp_buffer);
return retval;
}
static int usb_device_release(struct inode *inode, struct file *file)
{
- if (file->private_data) {
- kfree(file->private_data);
- file->private_data = NULL;
- }
-
+ kfree(file->private_data);
+ file->private_data = NULL;
return 0;
}
dev_err (&hdev->dev,
"clear tt %d (%04x) error %d\n",
clear->tt, clear->devinfo, status);
- kfree (clear);
+ kfree(clear);
}
spin_unlock_irqrestore (&hub->tt.lock, flags);
}
list_del_init(&hub->event_list);
spin_unlock_irq(&hub_event_lock);
- if (hub->descriptor) {
- kfree(hub->descriptor);
- hub->descriptor = NULL;
- }
+ kfree(hub->descriptor);
+ hub->descriptor = NULL;
- if (hub->status) {
- kfree(hub->status);
- hub->status = NULL;
- }
+ kfree(hub->status);
+ hub->status = NULL;
if (hub->buffer) {
usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer,
schedule_work (&hub->leds);
}
}
- kfree (qual);
+ kfree(qual);
}
static unsigned
*/
void gs_buf_free(struct gs_buf *gb)
{
- if (gb != NULL) {
- if (gb->buf_buf != NULL)
- kfree(gb->buf_buf);
+ if (gb) {
+ kfree(gb->buf_buf);
kfree(gb);
}
}
ehci->periodic = NULL;
/* shadow periodic table */
- if (ehci->pshadow)
- kfree (ehci->pshadow);
+ kfree(ehci->pshadow);
ehci->pshadow = NULL;
}
debugfs_remove(uhci_debugfs_root);
debug_failed:
- if (errbuf)
- kfree(errbuf);
+ kfree(errbuf);
errbuf_failed:
warn("not all urb_priv's were freed!");
debugfs_remove(uhci_debugfs_root);
-
- if (errbuf)
- kfree(errbuf);
+ kfree(errbuf);
}
module_init(uhci_hcd_init);
}
}
- if (device->rdesc)
- kfree(device->rdesc);
+ kfree(device->rdesc);
kfree(device);
}
#ifdef DEBUG
dump_urb(b->purb);
#endif
- if (b->purb->transfer_buffer)
- kfree (b->purb->transfer_buffer);
+ kfree(b->purb->transfer_buffer);
usb_free_urb(b->purb);
tmp = p->next;
list_del (p);
ov->tempfbuf = NULL;
for (i = 0; i < OV511_NUMSBUF; i++) {
- if (ov->sbuf[i].data) {
- kfree(ov->sbuf[i].data);
- ov->sbuf[i].data = NULL;
- }
+ kfree(ov->sbuf[i].data);
+ ov->sbuf[i].data = NULL;
}
for (i = 0; i < OV511_NUMFRAMES; i++) {
up(&ov->cbuf_lock);
}
- if (ov) {
- kfree(ov);
- ov = NULL;
- }
+ kfree(ov);
+ ov = NULL;
error_out:
err("Camera initialization failed");
se401->dev = NULL;
- for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) {
- usb_kill_urb(se401->urb[i]);
- usb_free_urb(se401->urb[i]);
- se401->urb[i] = NULL;
- kfree(se401->sbuf[i].data);
- }
- for (i=0; i<SE401_NUMSCRATCH; i++) if (se401->scratch[i].data) {
+ for (i=0; i<SE401_NUMSBUF; i++)
+ if (se401->urb[i]) {
+ usb_kill_urb(se401->urb[i]);
+ usb_free_urb(se401->urb[i]);
+ se401->urb[i] = NULL;
+ kfree(se401->sbuf[i].data);
+ }
+ for (i=0; i<SE401_NUMSCRATCH; i++) {
kfree(se401->scratch[i].data);
}
if (se401->inturb) {
}
RingQueue_Free(&uvd->dp);
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
- if (uvd->sbuf[i].data != NULL) {
- kfree (uvd->sbuf[i].data);
- uvd->sbuf[i].data = NULL;
- }
+ kfree(uvd->sbuf[i].data);
+ uvd->sbuf[i].data = NULL;
}
}
}
return 0;
fail: /* Free unused memory */
- if (cam->control_buffer)
- kfree(cam->control_buffer);
- if (cam->data_buffer)
- kfree(cam->data_buffer);
+ kfree(cam->control_buffer);
+ kfree(cam->data_buffer);
if (cam->v4ldev)
video_device_release(cam->v4ldev);
up(&cam->dev_sem);
/* free a single auerbuf */
static void auerbuf_free (pauerbuf_t bp)
{
- if (bp->bufp) {
- kfree (bp->bufp);
- }
- if (bp->dr) {
- kfree (bp->dr);
- }
+ kfree(bp->bufp);
+ kfree(bp->dr);
if (bp->urbp) {
- usb_free_urb (bp->urbp);
+ usb_free_urb(bp->urbp);
}
- kfree (bp);
+ kfree(bp);
}
/* free the buffers from an auerbuf list */
*/
static void auerswald_int_free (pauerswald_t cp)
{
- if (cp->inturbp) {
- usb_free_urb (cp->inturbp);
- cp->inturbp = NULL;
- }
- if (cp->intbufp) {
- kfree (cp->intbufp);
- cp->intbufp = NULL;
- }
+ if (cp->inturbp) {
+ usb_free_urb(cp->inturbp);
+ cp->inturbp = NULL;
+ }
+ kfree(cp->intbufp);
+ cp->intbufp = NULL;
}
/* This function is called to activate the interrupt
err = 0;
exit:
- if (buf)
- kfree(buf);
+ kfree(buf);
release_firmware(fw_entry);
return err;
}
for (i=0; i < serial->num_ports; ++i) {
/* My special items, the standard routines free my urbs */
priv = usb_get_serial_port_data(serial->port[i]);
- if (priv)
- kfree(priv);
+ kfree(priv);
}
}
static void cypress_buf_free(struct cypress_buf *cb)
{
- if (cb != NULL) {
- if (cb->buf_buf != NULL)
- kfree(cb->buf_buf);
+ if (cb) {
+ kfree(cb->buf_buf);
kfree(cb);
}
}
failed_usb_serial_register:
for (i = 0; i < NUM_URBS; ++i) {
if (write_urb_pool[i]) {
- if (write_urb_pool[i]->transfer_buffer)
- kfree(write_urb_pool[i]->transfer_buffer);
+ kfree(write_urb_pool[i]->transfer_buffer);
usb_free_urb(write_urb_pool[i]);
}
}
* the host controllers get fixed to set urb->dev = NULL after
* the urb is finished. Otherwise this call oopses. */
/* usb_kill_urb(write_urb_pool[i]); */
- if (write_urb_pool[i]->transfer_buffer)
- kfree(write_urb_pool[i]->transfer_buffer);
+ kfree(write_urb_pool[i]->transfer_buffer);
usb_free_urb (write_urb_pool[i]);
}
}
priv->flags = ASYNC_LOW_LATENCY;
/* Increase the size of read buffers */
- if (port->bulk_in_buffer) {
- kfree (port->bulk_in_buffer);
- }
+ kfree(port->bulk_in_buffer);
port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL);
if (!port->bulk_in_buffer) {
kfree (priv);
usb_free_urb (port->write_urb);
port->write_urb = NULL;
}
- if (port->bulk_out_buffer) {
- kfree (port->bulk_out_buffer);
- port->bulk_out_buffer = NULL;
- }
+ kfree(port->bulk_out_buffer);
+ port->bulk_out_buffer = NULL;
usb_set_serial_port_data(serial->port[0], priv);
/* 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);
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__);
}
// 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;
void edge_buf_free(struct edge_buf *eb)
{
- if (eb != NULL) {
- if (eb->buf_buf != NULL)
- kfree(eb->buf_buf);
+ if (eb) {
+ kfree(eb->buf_buf);
kfree(eb);
}
}
* finished. Otherwise this call
* oopses. */
/* usb_kill_urb(write_urbs[j]); */
- if (write_urbs[j]->transfer_buffer)
- kfree(write_urbs[j]->transfer_buffer);
+ kfree(write_urbs[j]->transfer_buffer);
usb_free_urb (write_urbs[j]);
}
}
{
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport;
- struct omninet_data *od;
dbg("%s - port %d", __FUNCTION__, port->number);
usb_kill_urb(wport->write_urb);
usb_kill_urb(port->read_urb);
- od = usb_get_serial_port_data(port);
- if (od)
- kfree(od);
+ kfree(usb_get_serial_port_data(port));
}
static void pl2303_buf_free(struct pl2303_buf *pb)
{
- if (pb != NULL) {
- if (pb->buf_buf != NULL)
- kfree(pb->buf_buf);
+ if (pb) {
+ kfree(pb->buf_buf);
kfree(pb);
}
}
}
}
- if (tdev)
- kfree(tdev);
+ kfree(tdev);
usb_set_serial_data(serial, NULL);
}
/* expect to get short transfer if no card fitted */
if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {
/* had a short transfer, no card inserted, free map memory */
- if (info->lba_to_pba)
- kfree(info->lba_to_pba);
- if (info->pba_to_lba)
- kfree(info->pba_to_lba);
+ kfree(info->lba_to_pba);
+ kfree(info->pba_to_lba);
info->lba_to_pba = NULL;
info->pba_to_lba = NULL;
return -1;
}
- if (info->lba_to_pba)
- kfree(info->lba_to_pba);
- if (info->pba_to_lba)
- kfree(info->pba_to_lba);
+ kfree(info->lba_to_pba);
+ kfree(info->pba_to_lba);
info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
- if (info->lba_to_pba != NULL)
- kfree(info->lba_to_pba);
- if (info->pba_to_lba != NULL)
- kfree(info->pba_to_lba);
+ kfree(info->lba_to_pba);
+ kfree(info->pba_to_lba);
info->lba_to_pba = NULL;
info->pba_to_lba = NULL;
kfree(buffer);
if (!extra)
return;
- if (info->lba_to_pba)
- kfree(info->lba_to_pba);
- if (info->pba_to_lba)
- kfree(info->pba_to_lba);
+ kfree(info->lba_to_pba);
+ kfree(info->pba_to_lba);
}