[PATCH] vfree and kfree cleanup in drivers/
This patch does a full cleanup of 'NULL checks before vfree', and a partial cleanup of calls to kfree for all of drivers/ - the kfree bit is partial in that I only did the files that also had vfree calls in them. The patch also gets rid of some redundant (void *) casts of pointers being passed to [vk]free, and a some tiny whitespace corrections also crept in. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
887c27f369
commit
f9101210e7
20 changed files with 86 additions and 142 deletions
|
@ -296,7 +296,7 @@ z2_open( struct inode *inode, struct file *filp )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_out_kfree:
|
err_out_kfree:
|
||||||
kfree( z2ram_map );
|
kfree(z2ram_map);
|
||||||
err_out:
|
err_out:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4216,7 +4216,8 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd,
|
||||||
|
|
||||||
case CDROMAUDIOBUFSIZ: /* configure the audio buffer size */
|
case CDROMAUDIOBUFSIZ: /* configure the audio buffer size */
|
||||||
msg(DBG_IOC,"ioctl: CDROMAUDIOBUFSIZ entered.\n");
|
msg(DBG_IOC,"ioctl: CDROMAUDIOBUFSIZ entered.\n");
|
||||||
if (current_drive->sbp_audsiz>0) vfree(current_drive->aud_buf);
|
if (current_drive->sbp_audsiz>0)
|
||||||
|
vfree(current_drive->aud_buf);
|
||||||
current_drive->aud_buf=NULL;
|
current_drive->aud_buf=NULL;
|
||||||
current_drive->sbp_audsiz=arg;
|
current_drive->sbp_audsiz=arg;
|
||||||
|
|
||||||
|
@ -5910,7 +5911,8 @@ static void sbpcd_exit(void)
|
||||||
put_disk(D_S[j].disk);
|
put_disk(D_S[j].disk);
|
||||||
devfs_remove("sbp/c0t%d", j);
|
devfs_remove("sbp/c0t%d", j);
|
||||||
vfree(D_S[j].sbp_buf);
|
vfree(D_S[j].sbp_buf);
|
||||||
if (D_S[j].sbp_audsiz>0) vfree(D_S[j].aud_buf);
|
if (D_S[j].sbp_audsiz>0)
|
||||||
|
vfree(D_S[j].aud_buf);
|
||||||
if ((unregister_cdrom(D_S[j].sbpcd_infop) == -EINVAL))
|
if ((unregister_cdrom(D_S[j].sbpcd_infop) == -EINVAL))
|
||||||
{
|
{
|
||||||
msg(DBG_INF, "What's that: can't unregister info %s.\n", major_name);
|
msg(DBG_INF, "What's that: can't unregister info %s.\n", major_name);
|
||||||
|
|
|
@ -206,10 +206,9 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge)
|
||||||
bridge->driver->cleanup();
|
bridge->driver->cleanup();
|
||||||
if (bridge->driver->free_gatt_table)
|
if (bridge->driver->free_gatt_table)
|
||||||
bridge->driver->free_gatt_table(bridge);
|
bridge->driver->free_gatt_table(bridge);
|
||||||
if (bridge->key_list) {
|
|
||||||
vfree(bridge->key_list);
|
vfree(bridge->key_list);
|
||||||
bridge->key_list = NULL;
|
bridge->key_list = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (bridge->driver->agp_destroy_page &&
|
if (bridge->driver->agp_destroy_page &&
|
||||||
bridge->driver->needs_scratch_page)
|
bridge->driver->needs_scratch_page)
|
||||||
|
|
|
@ -283,23 +283,19 @@ static void bsd_free (void *state)
|
||||||
/*
|
/*
|
||||||
* Release the dictionary
|
* Release the dictionary
|
||||||
*/
|
*/
|
||||||
if (db->dict) {
|
vfree(db->dict);
|
||||||
vfree (db->dict);
|
db->dict = NULL;
|
||||||
db->dict = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Release the string buffer
|
* Release the string buffer
|
||||||
*/
|
*/
|
||||||
if (db->lens) {
|
vfree(db->lens);
|
||||||
vfree (db->lens);
|
db->lens = NULL;
|
||||||
db->lens = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finally release the structure itself.
|
* Finally release the structure itself.
|
||||||
*/
|
*/
|
||||||
kfree (db);
|
kfree(db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1953,7 +1953,8 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
|
||||||
kfree(d->rcvcount);
|
kfree(d->rcvcount);
|
||||||
if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_ATOMIC))) {
|
if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_ATOMIC))) {
|
||||||
printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
|
printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
|
||||||
if (!adding) kfree(d->rcverr);
|
if (!adding)
|
||||||
|
kfree(d->rcverr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset((char *) d->rcvcount, 0, sizeof(int) * m);
|
memset((char *) d->rcvcount, 0, sizeof(int) * m);
|
||||||
|
|
|
@ -568,12 +568,9 @@ int dm_create_persistent(struct exception_store *store, uint32_t chunk_size)
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
dm_io_put(sectors_to_pages(chunk_size));
|
dm_io_put(sectors_to_pages(chunk_size));
|
||||||
if (ps) {
|
if (ps && ps->area)
|
||||||
if (ps->area)
|
free_area(ps);
|
||||||
free_area(ps);
|
kfree(ps);
|
||||||
|
|
||||||
kfree(ps);
|
|
||||||
}
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,10 +168,8 @@ void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt)
|
||||||
return;
|
return;
|
||||||
pci_free_consistent(pci, pt->size, pt->cpu, pt->dma);
|
pci_free_consistent(pci, pt->size, pt->cpu, pt->dma);
|
||||||
pt->cpu = NULL;
|
pt->cpu = NULL;
|
||||||
if (NULL != pt->slist) {
|
kfree(pt->slist);
|
||||||
kfree(pt->slist);
|
pt->slist = NULL;
|
||||||
pt->slist = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt)
|
int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt)
|
||||||
|
|
|
@ -445,10 +445,8 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try)
|
||||||
ucpia->sbuf[1].urb = NULL;
|
ucpia->sbuf[1].urb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ucpia->sbuf[1].data) {
|
kfree(ucpia->sbuf[1].data);
|
||||||
kfree(ucpia->sbuf[1].data);
|
ucpia->sbuf[1].data = NULL;
|
||||||
ucpia->sbuf[1].data = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ucpia->sbuf[0].urb) {
|
if (ucpia->sbuf[0].urb) {
|
||||||
usb_kill_urb(ucpia->sbuf[0].urb);
|
usb_kill_urb(ucpia->sbuf[0].urb);
|
||||||
|
@ -456,10 +454,8 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try)
|
||||||
ucpia->sbuf[0].urb = NULL;
|
ucpia->sbuf[0].urb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ucpia->sbuf[0].data) {
|
kfree(ucpia->sbuf[0].data);
|
||||||
kfree(ucpia->sbuf[0].data);
|
ucpia->sbuf[0].data = NULL;
|
||||||
ucpia->sbuf[0].data = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cpia_usb_close(void *privdata)
|
static int cpia_usb_close(void *privdata)
|
||||||
|
@ -623,20 +619,14 @@ static void cpia_disconnect(struct usb_interface *intf)
|
||||||
|
|
||||||
ucpia->curbuff = ucpia->workbuff = NULL;
|
ucpia->curbuff = ucpia->workbuff = NULL;
|
||||||
|
|
||||||
if (ucpia->buffers[2]) {
|
vfree(ucpia->buffers[2]);
|
||||||
vfree(ucpia->buffers[2]);
|
ucpia->buffers[2] = NULL;
|
||||||
ucpia->buffers[2] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ucpia->buffers[1]) {
|
vfree(ucpia->buffers[1]);
|
||||||
vfree(ucpia->buffers[1]);
|
ucpia->buffers[1] = NULL;
|
||||||
ucpia->buffers[1] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ucpia->buffers[0]) {
|
vfree(ucpia->buffers[0]);
|
||||||
vfree(ucpia->buffers[0]);
|
ucpia->buffers[0] = NULL;
|
||||||
ucpia->buffers[0] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cam->lowlevel_data = NULL;
|
cam->lowlevel_data = NULL;
|
||||||
kfree(ucpia);
|
kfree(ucpia);
|
||||||
|
|
|
@ -2184,30 +2184,18 @@ static void release_saa(void)
|
||||||
vfree(saa->vidbuf);
|
vfree(saa->vidbuf);
|
||||||
vfree(saa->audbuf);
|
vfree(saa->audbuf);
|
||||||
vfree(saa->osdbuf);
|
vfree(saa->osdbuf);
|
||||||
if (saa->dmavid2)
|
kfree(saa->dmavid2);
|
||||||
kfree((void *) saa->dmavid2);
|
|
||||||
saa->audbuf = saa->vidbuf = saa->osdbuf = NULL;
|
saa->audbuf = saa->vidbuf = saa->osdbuf = NULL;
|
||||||
saa->dmavid2 = NULL;
|
saa->dmavid2 = NULL;
|
||||||
if (saa->dmadebi)
|
kfree(saa->dmadebi);
|
||||||
kfree((void *) saa->dmadebi);
|
kfree(saa->dmavid1);
|
||||||
if (saa->dmavid1)
|
kfree(saa->dmavid3);
|
||||||
kfree((void *) saa->dmavid1);
|
kfree(saa->dmaa1in);
|
||||||
if (saa->dmavid2)
|
kfree(saa->dmaa1out);
|
||||||
kfree((void *) saa->dmavid2);
|
kfree(saa->dmaa2in);
|
||||||
if (saa->dmavid3)
|
kfree(saa->dmaa2out);
|
||||||
kfree((void *) saa->dmavid3);
|
kfree(saa->dmaRPS1);
|
||||||
if (saa->dmaa1in)
|
kfree(saa->dmaRPS2);
|
||||||
kfree((void *) saa->dmaa1in);
|
|
||||||
if (saa->dmaa1out)
|
|
||||||
kfree((void *) saa->dmaa1out);
|
|
||||||
if (saa->dmaa2in)
|
|
||||||
kfree((void *) saa->dmaa2in);
|
|
||||||
if (saa->dmaa2out)
|
|
||||||
kfree((void *) saa->dmaa2out);
|
|
||||||
if (saa->dmaRPS1)
|
|
||||||
kfree((void *) saa->dmaRPS1);
|
|
||||||
if (saa->dmaRPS2)
|
|
||||||
kfree((void *) saa->dmaRPS2);
|
|
||||||
free_irq(saa->irq, saa);
|
free_irq(saa->irq, saa);
|
||||||
if (saa->saa7146_mem)
|
if (saa->saa7146_mem)
|
||||||
iounmap(saa->saa7146_mem);
|
iounmap(saa->saa7146_mem);
|
||||||
|
|
|
@ -267,10 +267,10 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
|
||||||
kfree(dma->pages);
|
kfree(dma->pages);
|
||||||
dma->pages = NULL;
|
dma->pages = NULL;
|
||||||
}
|
}
|
||||||
if (dma->vmalloc) {
|
|
||||||
vfree(dma->vmalloc);
|
vfree(dma->vmalloc);
|
||||||
dma->vmalloc = NULL;
|
dma->vmalloc = NULL;
|
||||||
}
|
|
||||||
if (dma->bus_addr) {
|
if (dma->bus_addr) {
|
||||||
dma->bus_addr = 0;
|
dma->bus_addr = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -650,7 +650,7 @@ jpg_fbuffer_free (struct file *file)
|
||||||
off += PAGE_SIZE)
|
off += PAGE_SIZE)
|
||||||
ClearPageReserved(MAP_NR
|
ClearPageReserved(MAP_NR
|
||||||
(mem + off));
|
(mem + off));
|
||||||
kfree((void *) mem);
|
kfree(mem);
|
||||||
fh->jpg_buffers.buffer[i].frag_tab[0] = 0;
|
fh->jpg_buffers.buffer[i].frag_tab[0] = 0;
|
||||||
fh->jpg_buffers.buffer[i].frag_tab[1] = 0;
|
fh->jpg_buffers.buffer[i].frag_tab[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -820,11 +820,9 @@ void zoran_close(struct video_device* dev)
|
||||||
msleep(100); /* Wait 1/10th of a second */
|
msleep(100); /* Wait 1/10th of a second */
|
||||||
|
|
||||||
/* free the allocated framebuffer */
|
/* free the allocated framebuffer */
|
||||||
if (ztv->fbuffer)
|
bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE);
|
||||||
bfree( ztv->fbuffer, ZORAN_MAX_FBUFSIZE );
|
|
||||||
ztv->fbuffer = 0;
|
ztv->fbuffer = 0;
|
||||||
if (ztv->overinfo.overlay)
|
kfree(ztv->overinfo.overlay);
|
||||||
kfree( ztv->overinfo.overlay );
|
|
||||||
ztv->overinfo.overlay = 0;
|
ztv->overinfo.overlay = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,8 +91,7 @@ static void __exit cleanup_mtdram(void)
|
||||||
{
|
{
|
||||||
if (mtd_info) {
|
if (mtd_info) {
|
||||||
del_mtd_device(mtd_info);
|
del_mtd_device(mtd_info);
|
||||||
if (mtd_info->priv)
|
vfree(mtd_info->priv);
|
||||||
vfree(mtd_info->priv);
|
|
||||||
kfree(mtd_info);
|
kfree(mtd_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1017,27 +1017,16 @@ static int ftl_writesect(struct mtd_blktrans_dev *dev,
|
||||||
|
|
||||||
void ftl_freepart(partition_t *part)
|
void ftl_freepart(partition_t *part)
|
||||||
{
|
{
|
||||||
if (part->VirtualBlockMap) {
|
|
||||||
vfree(part->VirtualBlockMap);
|
vfree(part->VirtualBlockMap);
|
||||||
part->VirtualBlockMap = NULL;
|
part->VirtualBlockMap = NULL;
|
||||||
}
|
|
||||||
if (part->VirtualPageMap) {
|
|
||||||
kfree(part->VirtualPageMap);
|
kfree(part->VirtualPageMap);
|
||||||
part->VirtualPageMap = NULL;
|
part->VirtualPageMap = NULL;
|
||||||
}
|
|
||||||
if (part->EUNInfo) {
|
|
||||||
kfree(part->EUNInfo);
|
kfree(part->EUNInfo);
|
||||||
part->EUNInfo = NULL;
|
part->EUNInfo = NULL;
|
||||||
}
|
|
||||||
if (part->XferInfo) {
|
|
||||||
kfree(part->XferInfo);
|
kfree(part->XferInfo);
|
||||||
part->XferInfo = NULL;
|
part->XferInfo = NULL;
|
||||||
}
|
|
||||||
if (part->bam_cache) {
|
|
||||||
kfree(part->bam_cache);
|
kfree(part->bam_cache);
|
||||||
part->bam_cache = NULL;
|
part->bam_cache = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
} /* ftl_freepart */
|
} /* ftl_freepart */
|
||||||
|
|
||||||
static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
|
static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
|
||||||
|
|
|
@ -323,33 +323,27 @@ static void bsd_reset (void *state)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void bsd_free (void *state)
|
static void bsd_free (void *state)
|
||||||
{
|
{
|
||||||
struct bsd_db *db = (struct bsd_db *) state;
|
struct bsd_db *db = state;
|
||||||
|
|
||||||
if (db)
|
if (!db)
|
||||||
{
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Release the dictionary
|
* Release the dictionary
|
||||||
*/
|
*/
|
||||||
if (db->dict)
|
vfree(db->dict);
|
||||||
{
|
db->dict = NULL;
|
||||||
vfree (db->dict);
|
|
||||||
db->dict = NULL;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Release the string buffer
|
* Release the string buffer
|
||||||
*/
|
*/
|
||||||
if (db->lens)
|
vfree(db->lens);
|
||||||
{
|
db->lens = NULL;
|
||||||
vfree (db->lens);
|
|
||||||
db->lens = NULL;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Finally release the structure itself.
|
* Finally release the structure itself.
|
||||||
*/
|
*/
|
||||||
kfree (db);
|
kfree(db);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate space for a (de) compressor.
|
* Allocate space for a (de) compressor.
|
||||||
|
|
|
@ -6090,8 +6090,8 @@ NCR53c7x0_release(struct Scsi_Host *host) {
|
||||||
if (hostdata->num_cmds)
|
if (hostdata->num_cmds)
|
||||||
printk ("scsi%d : leaked %d NCR53c7x0_cmd structures\n",
|
printk ("scsi%d : leaked %d NCR53c7x0_cmd structures\n",
|
||||||
host->host_no, hostdata->num_cmds);
|
host->host_no, hostdata->num_cmds);
|
||||||
if (hostdata->events)
|
|
||||||
vfree ((void *)hostdata->events);
|
vfree(hostdata->events);
|
||||||
|
|
||||||
/* XXX This assumes default cache mode to be IOMAP_FULL_CACHING, which
|
/* XXX This assumes default cache mode to be IOMAP_FULL_CACHING, which
|
||||||
* XXX may be invalid (CONFIG_060_WRITETHROUGH)
|
* XXX may be invalid (CONFIG_060_WRITETHROUGH)
|
||||||
|
|
|
@ -691,8 +691,7 @@ int cpqfcTS_ioctl( struct scsi_device *ScsiDev, int Cmnd, void *arg)
|
||||||
if( copy_to_user( vendor_cmd->bufp, buf, vendor_cmd->len))
|
if( copy_to_user( vendor_cmd->bufp, buf, vendor_cmd->len))
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
|
|
||||||
if( buf)
|
kfree(buf);
|
||||||
kfree( buf);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1377,7 +1377,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi
|
||||||
|
|
||||||
if ((STp->buffer)->syscall_result || !SRpnt) {
|
if ((STp->buffer)->syscall_result || !SRpnt) {
|
||||||
printk(KERN_ERR "%s:E: Failed to read frame back from OnStream buffer\n", name);
|
printk(KERN_ERR "%s:E: Failed to read frame back from OnStream buffer\n", name);
|
||||||
vfree((void *)buffer);
|
vfree(buffer);
|
||||||
*aSRpnt = SRpnt;
|
*aSRpnt = SRpnt;
|
||||||
return (-EIO);
|
return (-EIO);
|
||||||
}
|
}
|
||||||
|
@ -1419,7 +1419,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi
|
||||||
|
|
||||||
if (new_frame > frame + 1000) {
|
if (new_frame > frame + 1000) {
|
||||||
printk(KERN_ERR "%s:E: Failed to find writable tape media\n", name);
|
printk(KERN_ERR "%s:E: Failed to find writable tape media\n", name);
|
||||||
vfree((void *)buffer);
|
vfree(buffer);
|
||||||
return (-EIO);
|
return (-EIO);
|
||||||
}
|
}
|
||||||
if ( i >= nframes + pending ) break;
|
if ( i >= nframes + pending ) break;
|
||||||
|
@ -1500,7 +1500,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi
|
||||||
SRpnt->sr_sense_buffer[12] == 0 &&
|
SRpnt->sr_sense_buffer[12] == 0 &&
|
||||||
SRpnt->sr_sense_buffer[13] == 2) {
|
SRpnt->sr_sense_buffer[13] == 2) {
|
||||||
printk(KERN_ERR "%s:E: Volume overflow in write error recovery\n", name);
|
printk(KERN_ERR "%s:E: Volume overflow in write error recovery\n", name);
|
||||||
vfree((void *)buffer);
|
vfree(buffer);
|
||||||
return (-EIO); /* hit end of tape = fail */
|
return (-EIO); /* hit end of tape = fail */
|
||||||
}
|
}
|
||||||
i = ((SRpnt->sr_sense_buffer[3] << 24) |
|
i = ((SRpnt->sr_sense_buffer[3] << 24) |
|
||||||
|
@ -1525,7 +1525,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi
|
||||||
}
|
}
|
||||||
if (!pending)
|
if (!pending)
|
||||||
osst_copy_to_buffer(STp->buffer, p); /* so buffer content == at entry in all cases */
|
osst_copy_to_buffer(STp->buffer, p); /* so buffer content == at entry in all cases */
|
||||||
vfree((void *)buffer);
|
vfree(buffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5852,7 +5852,7 @@ static int osst_remove(struct device *dev)
|
||||||
os_scsi_tapes[i] = NULL;
|
os_scsi_tapes[i] = NULL;
|
||||||
osst_nr_dev--;
|
osst_nr_dev--;
|
||||||
write_unlock(&os_scsi_tapes_lock);
|
write_unlock(&os_scsi_tapes_lock);
|
||||||
if (tpnt->header_cache != NULL) vfree(tpnt->header_cache);
|
vfree(tpnt->header_cache);
|
||||||
if (tpnt->buffer) {
|
if (tpnt->buffer) {
|
||||||
normalize_buffer(tpnt->buffer);
|
normalize_buffer(tpnt->buffer);
|
||||||
kfree(tpnt->buffer);
|
kfree(tpnt->buffer);
|
||||||
|
@ -5896,8 +5896,7 @@ static void __exit exit_osst (void)
|
||||||
for (i=0; i < osst_max_dev; ++i) {
|
for (i=0; i < osst_max_dev; ++i) {
|
||||||
if (!(STp = os_scsi_tapes[i])) continue;
|
if (!(STp = os_scsi_tapes[i])) continue;
|
||||||
/* This is defensive, supposed to happen during detach */
|
/* This is defensive, supposed to happen during detach */
|
||||||
if (STp->header_cache)
|
vfree(STp->header_cache);
|
||||||
vfree(STp->header_cache);
|
|
||||||
if (STp->buffer) {
|
if (STp->buffer) {
|
||||||
normalize_buffer(STp->buffer);
|
normalize_buffer(STp->buffer);
|
||||||
kfree(STp->buffer);
|
kfree(STp->buffer);
|
||||||
|
|
|
@ -260,7 +260,7 @@ static int stv_stop_video (struct usb_stv *dev)
|
||||||
PDEBUG (0, "STV(i): Camera set to original resolution");
|
PDEBUG (0, "STV(i): Camera set to original resolution");
|
||||||
}
|
}
|
||||||
/* origMode */
|
/* origMode */
|
||||||
kfree (buf);
|
kfree(buf);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ static int stv_set_video_mode (struct usb_stv *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i = stv_set_config (dev, 1, 0, 0)) < 0) {
|
if ((i = stv_set_config (dev, 1, 0, 0)) < 0) {
|
||||||
kfree (buf);
|
kfree(buf);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,13 +301,13 @@ static int stv_set_video_mode (struct usb_stv *dev)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
kfree (buf);
|
kfree(buf);
|
||||||
if (stop_video == 1)
|
if (stop_video == 1)
|
||||||
stv_stop_video (dev);
|
stv_stop_video (dev);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
kfree (buf);
|
kfree(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ static int stv_init (struct usb_stv *stv680)
|
||||||
|
|
||||||
/* set config 1, interface 0, alternate 0 */
|
/* set config 1, interface 0, alternate 0 */
|
||||||
if ((i = stv_set_config (stv680, 1, 0, 0)) < 0) {
|
if ((i = stv_set_config (stv680, 1, 0, 0)) < 0) {
|
||||||
kfree (buffer);
|
kfree(buffer);
|
||||||
PDEBUG (0, "STV(e): set config 1,0,0 failed");
|
PDEBUG (0, "STV(e): set config 1,0,0 failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -435,11 +435,11 @@ static int stv_init (struct usb_stv *stv680)
|
||||||
error:
|
error:
|
||||||
i = stv_sndctrl (0, stv680, 0x80, 0, buffer, 0x02); /* Get Last Error */
|
i = stv_sndctrl (0, stv680, 0x80, 0, buffer, 0x02); /* Get Last Error */
|
||||||
PDEBUG (1, "STV(i): last error: %i, command = 0x%x", buffer[0], buffer[1]);
|
PDEBUG (1, "STV(i): last error: %i, command = 0x%x", buffer[0], buffer[1]);
|
||||||
kfree (buffer);
|
kfree(buffer);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
kfree (buffer);
|
kfree(buffer);
|
||||||
|
|
||||||
/* video = 320x240, 352x288 */
|
/* video = 320x240, 352x288 */
|
||||||
if (stv680->CIF == 1) {
|
if (stv680->CIF == 1) {
|
||||||
|
@ -708,10 +708,10 @@ static int stv680_stop_stream (struct usb_stv *stv680)
|
||||||
usb_kill_urb (stv680->urb[i]);
|
usb_kill_urb (stv680->urb[i]);
|
||||||
usb_free_urb (stv680->urb[i]);
|
usb_free_urb (stv680->urb[i]);
|
||||||
stv680->urb[i] = NULL;
|
stv680->urb[i] = NULL;
|
||||||
kfree (stv680->sbuf[i].data);
|
kfree(stv680->sbuf[i].data);
|
||||||
}
|
}
|
||||||
for (i = 0; i < STV680_NUMSCRATCH; i++) {
|
for (i = 0; i < STV680_NUMSCRATCH; i++) {
|
||||||
kfree (stv680->scratch[i].data);
|
kfree(stv680->scratch[i].data);
|
||||||
stv680->scratch[i].data = NULL;
|
stv680->scratch[i].data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,7 +1068,7 @@ static int stv_close (struct inode *inode, struct file *file)
|
||||||
stv680->user = 0;
|
stv680->user = 0;
|
||||||
|
|
||||||
if (stv680->removed) {
|
if (stv680->removed) {
|
||||||
kfree (stv680);
|
kfree(stv680);
|
||||||
stv680 = NULL;
|
stv680 = NULL;
|
||||||
PDEBUG (0, "STV(i): device unregistered");
|
PDEBUG (0, "STV(i): device unregistered");
|
||||||
}
|
}
|
||||||
|
@ -1445,14 +1445,14 @@ static inline void usb_stv680_remove_disconnected (struct usb_stv *stv680)
|
||||||
usb_kill_urb (stv680->urb[i]);
|
usb_kill_urb (stv680->urb[i]);
|
||||||
usb_free_urb (stv680->urb[i]);
|
usb_free_urb (stv680->urb[i]);
|
||||||
stv680->urb[i] = NULL;
|
stv680->urb[i] = NULL;
|
||||||
kfree (stv680->sbuf[i].data);
|
kfree(stv680->sbuf[i].data);
|
||||||
}
|
}
|
||||||
for (i = 0; i < STV680_NUMSCRATCH; i++)
|
for (i = 0; i < STV680_NUMSCRATCH; i++)
|
||||||
kfree (stv680->scratch[i].data);
|
kfree(stv680->scratch[i].data);
|
||||||
PDEBUG (0, "STV(i): %s disconnected", stv680->camera_name);
|
PDEBUG (0, "STV(i): %s disconnected", stv680->camera_name);
|
||||||
|
|
||||||
/* Free the memory */
|
/* Free the memory */
|
||||||
kfree (stv680);
|
kfree(stv680);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stv680_disconnect (struct usb_interface *intf)
|
static void stv680_disconnect (struct usb_interface *intf)
|
||||||
|
|
|
@ -342,16 +342,11 @@ static void vga_cleanup(struct vgastate *state)
|
||||||
if (state->vidstate != NULL) {
|
if (state->vidstate != NULL) {
|
||||||
struct regstate *saved = (struct regstate *) state->vidstate;
|
struct regstate *saved = (struct regstate *) state->vidstate;
|
||||||
|
|
||||||
if (saved->vga_font0)
|
vfree(saved->vga_font0);
|
||||||
vfree(saved->vga_font0);
|
vfree(saved->vga_font1);
|
||||||
if (saved->vga_font1)
|
vfree(saved->vga_text);
|
||||||
vfree(saved->vga_font1);
|
vfree(saved->vga_cmap);
|
||||||
if (saved->vga_text)
|
vfree(saved->attr);
|
||||||
vfree(saved->vga_text);
|
|
||||||
if (saved->vga_cmap)
|
|
||||||
vfree(saved->vga_cmap);
|
|
||||||
if (saved->attr)
|
|
||||||
vfree(saved->attr);
|
|
||||||
kfree(saved);
|
kfree(saved);
|
||||||
state->vidstate = NULL;
|
state->vidstate = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue