diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2005-09-10 03:26:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-10 13:06:30 -0400 |
commit | f9101210e7aa72daf92722d451a2f7e3af5f781f (patch) | |
tree | 9554007e19387f2d05352ab03332be50c5b95f5b /drivers/media | |
parent | 887c27f369abc458556a5ce8ab22ddd498474307 (diff) |
[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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/common/saa7146_core.c | 6 | ||||
-rw-r--r-- | drivers/media/video/cpia_usb.c | 30 | ||||
-rw-r--r-- | drivers/media/video/stradis.c | 32 | ||||
-rw-r--r-- | drivers/media/video/video-buf.c | 8 | ||||
-rw-r--r-- | drivers/media/video/zoran_driver.c | 2 | ||||
-rw-r--r-- | drivers/media/video/zr36120.c | 6 |
6 files changed, 29 insertions, 55 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index cd5828b5e9e3..206cc2f61f26 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -168,10 +168,8 @@ void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt) | |||
168 | return; | 168 | return; |
169 | pci_free_consistent(pci, pt->size, pt->cpu, pt->dma); | 169 | pci_free_consistent(pci, pt->size, pt->cpu, pt->dma); |
170 | pt->cpu = NULL; | 170 | pt->cpu = NULL; |
171 | if (NULL != pt->slist) { | 171 | kfree(pt->slist); |
172 | kfree(pt->slist); | 172 | pt->slist = NULL; |
173 | pt->slist = NULL; | ||
174 | } | ||
175 | } | 173 | } |
176 | 174 | ||
177 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) | 175 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) |
diff --git a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c index cdda423386c5..9774e94d1e7d 100644 --- a/drivers/media/video/cpia_usb.c +++ b/drivers/media/video/cpia_usb.c | |||
@@ -445,10 +445,8 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try) | |||
445 | ucpia->sbuf[1].urb = NULL; | 445 | ucpia->sbuf[1].urb = NULL; |
446 | } | 446 | } |
447 | 447 | ||
448 | if (ucpia->sbuf[1].data) { | 448 | kfree(ucpia->sbuf[1].data); |
449 | kfree(ucpia->sbuf[1].data); | 449 | ucpia->sbuf[1].data = NULL; |
450 | ucpia->sbuf[1].data = NULL; | ||
451 | } | ||
452 | 450 | ||
453 | if (ucpia->sbuf[0].urb) { | 451 | if (ucpia->sbuf[0].urb) { |
454 | usb_kill_urb(ucpia->sbuf[0].urb); | 452 | usb_kill_urb(ucpia->sbuf[0].urb); |
@@ -456,10 +454,8 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try) | |||
456 | ucpia->sbuf[0].urb = NULL; | 454 | ucpia->sbuf[0].urb = NULL; |
457 | } | 455 | } |
458 | 456 | ||
459 | if (ucpia->sbuf[0].data) { | 457 | kfree(ucpia->sbuf[0].data); |
460 | kfree(ucpia->sbuf[0].data); | 458 | ucpia->sbuf[0].data = NULL; |
461 | ucpia->sbuf[0].data = NULL; | ||
462 | } | ||
463 | } | 459 | } |
464 | 460 | ||
465 | static int cpia_usb_close(void *privdata) | 461 | static int cpia_usb_close(void *privdata) |
@@ -623,20 +619,14 @@ static void cpia_disconnect(struct usb_interface *intf) | |||
623 | 619 | ||
624 | ucpia->curbuff = ucpia->workbuff = NULL; | 620 | ucpia->curbuff = ucpia->workbuff = NULL; |
625 | 621 | ||
626 | if (ucpia->buffers[2]) { | 622 | vfree(ucpia->buffers[2]); |
627 | vfree(ucpia->buffers[2]); | 623 | ucpia->buffers[2] = NULL; |
628 | ucpia->buffers[2] = NULL; | ||
629 | } | ||
630 | 624 | ||
631 | if (ucpia->buffers[1]) { | 625 | vfree(ucpia->buffers[1]); |
632 | vfree(ucpia->buffers[1]); | 626 | ucpia->buffers[1] = NULL; |
633 | ucpia->buffers[1] = NULL; | ||
634 | } | ||
635 | 627 | ||
636 | if (ucpia->buffers[0]) { | 628 | vfree(ucpia->buffers[0]); |
637 | vfree(ucpia->buffers[0]); | 629 | ucpia->buffers[0] = NULL; |
638 | ucpia->buffers[0] = NULL; | ||
639 | } | ||
640 | 630 | ||
641 | cam->lowlevel_data = NULL; | 631 | cam->lowlevel_data = NULL; |
642 | kfree(ucpia); | 632 | kfree(ucpia); |
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index b57743571087..d4497dbae05c 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -2184,30 +2184,18 @@ static void release_saa(void) | |||
2184 | vfree(saa->vidbuf); | 2184 | vfree(saa->vidbuf); |
2185 | vfree(saa->audbuf); | 2185 | vfree(saa->audbuf); |
2186 | vfree(saa->osdbuf); | 2186 | vfree(saa->osdbuf); |
2187 | if (saa->dmavid2) | 2187 | kfree(saa->dmavid2); |
2188 | kfree((void *) saa->dmavid2); | ||
2189 | saa->audbuf = saa->vidbuf = saa->osdbuf = NULL; | 2188 | saa->audbuf = saa->vidbuf = saa->osdbuf = NULL; |
2190 | saa->dmavid2 = NULL; | 2189 | saa->dmavid2 = NULL; |
2191 | if (saa->dmadebi) | 2190 | kfree(saa->dmadebi); |
2192 | kfree((void *) saa->dmadebi); | 2191 | kfree(saa->dmavid1); |
2193 | if (saa->dmavid1) | 2192 | kfree(saa->dmavid3); |
2194 | kfree((void *) saa->dmavid1); | 2193 | kfree(saa->dmaa1in); |
2195 | if (saa->dmavid2) | 2194 | kfree(saa->dmaa1out); |
2196 | kfree((void *) saa->dmavid2); | 2195 | kfree(saa->dmaa2in); |
2197 | if (saa->dmavid3) | 2196 | kfree(saa->dmaa2out); |
2198 | kfree((void *) saa->dmavid3); | 2197 | kfree(saa->dmaRPS1); |
2199 | if (saa->dmaa1in) | 2198 | kfree(saa->dmaRPS2); |
2200 | kfree((void *) saa->dmaa1in); | ||
2201 | if (saa->dmaa1out) | ||
2202 | kfree((void *) saa->dmaa1out); | ||
2203 | if (saa->dmaa2in) | ||
2204 | kfree((void *) saa->dmaa2in); | ||
2205 | if (saa->dmaa2out) | ||
2206 | kfree((void *) saa->dmaa2out); | ||
2207 | if (saa->dmaRPS1) | ||
2208 | kfree((void *) saa->dmaRPS1); | ||
2209 | if (saa->dmaRPS2) | ||
2210 | kfree((void *) saa->dmaRPS2); | ||
2211 | free_irq(saa->irq, saa); | 2199 | free_irq(saa->irq, saa); |
2212 | if (saa->saa7146_mem) | 2200 | if (saa->saa7146_mem) |
2213 | iounmap(saa->saa7146_mem); | 2201 | iounmap(saa->saa7146_mem); |
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 97354f253a80..574b8e36f3c6 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
@@ -267,10 +267,10 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma) | |||
267 | kfree(dma->pages); | 267 | kfree(dma->pages); |
268 | dma->pages = NULL; | 268 | dma->pages = NULL; |
269 | } | 269 | } |
270 | if (dma->vmalloc) { | 270 | |
271 | vfree(dma->vmalloc); | 271 | vfree(dma->vmalloc); |
272 | dma->vmalloc = NULL; | 272 | dma->vmalloc = NULL; |
273 | } | 273 | |
274 | if (dma->bus_addr) { | 274 | if (dma->bus_addr) { |
275 | dma->bus_addr = 0; | 275 | dma->bus_addr = 0; |
276 | } | 276 | } |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index ba838a42ec80..53adeb70f2ca 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -650,7 +650,7 @@ jpg_fbuffer_free (struct file *file) | |||
650 | off += PAGE_SIZE) | 650 | off += PAGE_SIZE) |
651 | ClearPageReserved(MAP_NR | 651 | ClearPageReserved(MAP_NR |
652 | (mem + off)); | 652 | (mem + off)); |
653 | kfree((void *) mem); | 653 | kfree(mem); |
654 | fh->jpg_buffers.buffer[i].frag_tab[0] = 0; | 654 | fh->jpg_buffers.buffer[i].frag_tab[0] = 0; |
655 | fh->jpg_buffers.buffer[i].frag_tab[1] = 0; | 655 | fh->jpg_buffers.buffer[i].frag_tab[1] = 0; |
656 | } | 656 | } |
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index c33533155cc7..07286816d7df 100644 --- a/drivers/media/video/zr36120.c +++ b/drivers/media/video/zr36120.c | |||
@@ -820,11 +820,9 @@ void zoran_close(struct video_device* dev) | |||
820 | msleep(100); /* Wait 1/10th of a second */ | 820 | msleep(100); /* Wait 1/10th of a second */ |
821 | 821 | ||
822 | /* free the allocated framebuffer */ | 822 | /* free the allocated framebuffer */ |
823 | if (ztv->fbuffer) | 823 | bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE); |
824 | bfree( ztv->fbuffer, ZORAN_MAX_FBUFSIZE ); | ||
825 | ztv->fbuffer = 0; | 824 | ztv->fbuffer = 0; |
826 | if (ztv->overinfo.overlay) | 825 | kfree(ztv->overinfo.overlay); |
827 | kfree( ztv->overinfo.overlay ); | ||
828 | ztv->overinfo.overlay = 0; | 826 | ztv->overinfo.overlay = 0; |
829 | 827 | ||
830 | } | 828 | } |