aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2005-11-07 04:01:31 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:54:04 -0500
commit2ea7533060e361810c21b2f5ee02151c4dfb85d8 (patch)
tree9d8a5375c716879142dff583dfa6abddd79fefcc /drivers/media
parent17fd682e544556a2a829e94383239c029bb21c5e (diff)
[PATCH] kfree cleanup: drivers/media
This is the drivers/media/ part of the big kfree cleanup patch. Remove pointless checks for NULL prior to calling kfree() in drivers/media/. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Cc: Johannes Stezenbach <js@linuxtv.org> Cc: Michael Krufky <mkrufky@m1k.net> Cc: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Acked-by : Manu Abraham <manu@linuxtv.org> Acked-by: Andreas Oberritter <obi@linuxtv.org> Acked-by: Wilson Michaels <wilsonmichaels@earthlink.net> 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/dvb/bt8xx/dst.c8
-rw-r--r--drivers/media/dvb/frontends/dvb_dummy_fe.c4
-rw-r--r--drivers/media/dvb/frontends/l64781.c3
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c3
-rw-r--r--drivers/media/dvb/frontends/mt312.c3
-rw-r--r--drivers/media/dvb/frontends/or51132.c3
-rw-r--r--drivers/media/video/arv.c12
-rw-r--r--drivers/media/video/bttv-driver.c6
-rw-r--r--drivers/media/video/v4l1-compat.c6
-rw-r--r--drivers/media/video/videocodec.c6
-rw-r--r--drivers/media/video/videodev.c3
-rw-r--r--drivers/media/video/zoran_card.c14
12 files changed, 26 insertions, 45 deletions
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 34a837a1abf4..b3c9d7327ac1 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -1331,9 +1331,7 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad
1331{ 1331{
1332 /* check if the ASIC is there */ 1332 /* check if the ASIC is there */
1333 if (dst_probe(state) < 0) { 1333 if (dst_probe(state) < 0) {
1334 if (state) 1334 kfree(state);
1335 kfree(state);
1336
1337 return NULL; 1335 return NULL;
1338 } 1336 }
1339 /* determine settings based on type */ 1337 /* determine settings based on type */
@@ -1349,9 +1347,7 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad
1349 break; 1347 break;
1350 default: 1348 default:
1351 dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist."); 1349 dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist.");
1352 if (state) 1350 kfree(state);
1353 kfree(state);
1354
1355 return NULL; 1351 return NULL;
1356 } 1352 }
1357 1353
diff --git a/drivers/media/dvb/frontends/dvb_dummy_fe.c b/drivers/media/dvb/frontends/dvb_dummy_fe.c
index 794be520d590..645946a992d9 100644
--- a/drivers/media/dvb/frontends/dvb_dummy_fe.c
+++ b/drivers/media/dvb/frontends/dvb_dummy_fe.c
@@ -148,7 +148,7 @@ struct dvb_frontend* dvb_dummy_fe_qpsk_attach()
148 return &state->frontend; 148 return &state->frontend;
149 149
150error: 150error:
151 if (state) kfree(state); 151 kfree(state);
152 return NULL; 152 return NULL;
153} 153}
154 154
@@ -171,7 +171,7 @@ struct dvb_frontend* dvb_dummy_fe_qam_attach()
171 return &state->frontend; 171 return &state->frontend;
172 172
173error: 173error:
174 if (state) kfree(state); 174 kfree(state);
175 return NULL; 175 return NULL;
176} 176}
177 177
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c
index faaad1ae8559..19b4bf7c21a7 100644
--- a/drivers/media/dvb/frontends/l64781.c
+++ b/drivers/media/dvb/frontends/l64781.c
@@ -559,7 +559,8 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
559 return &state->frontend; 559 return &state->frontend;
560 560
561error: 561error:
562 if (reg0x3e >= 0) l64781_writereg (state, 0x3e, reg0x3e); /* restore reg 0x3e */ 562 if (reg0x3e >= 0)
563 l64781_writereg (state, 0x3e, reg0x3e); /* restore reg 0x3e */
563 kfree(state); 564 kfree(state);
564 return NULL; 565 return NULL;
565} 566}
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c
index 8dde72bd1046..7852b83b82d4 100644
--- a/drivers/media/dvb/frontends/lgdt330x.c
+++ b/drivers/media/dvb/frontends/lgdt330x.c
@@ -731,8 +731,7 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
731 return &state->frontend; 731 return &state->frontend;
732 732
733error: 733error:
734 if (state) 734 kfree(state);
735 kfree(state);
736 dprintk("%s: ERROR\n",__FUNCTION__); 735 dprintk("%s: ERROR\n",__FUNCTION__);
737 return NULL; 736 return NULL;
738} 737}
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c
index e38454901dd1..9c67f406d581 100644
--- a/drivers/media/dvb/frontends/mt312.c
+++ b/drivers/media/dvb/frontends/mt312.c
@@ -677,8 +677,7 @@ struct dvb_frontend* mt312_attach(const struct mt312_config* config,
677 return &state->frontend; 677 return &state->frontend;
678 678
679error: 679error:
680 if (state) 680 kfree(state);
681 kfree(state);
682 return NULL; 681 return NULL;
683} 682}
684 683
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c
index 817b044c7fd1..fc74c40d6477 100644
--- a/drivers/media/dvb/frontends/or51132.c
+++ b/drivers/media/dvb/frontends/or51132.c
@@ -577,8 +577,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
577 return &state->frontend; 577 return &state->frontend;
578 578
579error: 579error:
580 if (state) 580 kfree(state);
581 kfree(state);
582 return NULL; 581 return NULL;
583} 582}
584 583
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 87fd3a7bb392..0823ddaf7004 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -865,10 +865,8 @@ out_dev:
865 865
866out_irq: 866out_irq:
867#endif 867#endif
868 for (i = 0; i < MAX_AR_HEIGHT; i++) { 868 for (i = 0; i < MAX_AR_HEIGHT; i++)
869 if (ar->frame[i]) 869 kfree(ar->frame[i]);
870 kfree(ar->frame[i]);
871 }
872 870
873out_line_buff: 871out_line_buff:
874#if USE_INT 872#if USE_INT
@@ -899,10 +897,8 @@ static void __exit ar_cleanup_module(void)
899#if USE_INT 897#if USE_INT
900 free_irq(M32R_IRQ_INT3, ar); 898 free_irq(M32R_IRQ_INT3, ar);
901#endif 899#endif
902 for (i = 0; i < MAX_AR_HEIGHT; i++) { 900 for (i = 0; i < MAX_AR_HEIGHT; i++)
903 if (ar->frame[i]) 901 kfree(ar->frame[i]);
904 kfree(ar->frame[i]);
905 }
906#if USE_INT 902#if USE_INT
907 kfree(ar->line_buff); 903 kfree(ar->line_buff);
908#endif 904#endif
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index c062a017491e..d538a994ff04 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -1951,8 +1951,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
1951 } 1951 }
1952 1952
1953 down(&fh->cap.lock); 1953 down(&fh->cap.lock);
1954 if (fh->ov.clips) 1954 kfree(fh->ov.clips);
1955 kfree(fh->ov.clips);
1956 fh->ov.clips = clips; 1955 fh->ov.clips = clips;
1957 fh->ov.nclips = n; 1956 fh->ov.nclips = n;
1958 1957
@@ -2723,8 +2722,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2723 fh->ov.w.height = fb->fmt.height; 2722 fh->ov.w.height = fb->fmt.height;
2724 btv->init.ov.w.width = fb->fmt.width; 2723 btv->init.ov.w.width = fb->fmt.width;
2725 btv->init.ov.w.height = fb->fmt.height; 2724 btv->init.ov.w.height = fb->fmt.height;
2726 if (fh->ov.clips) 2725 kfree(fh->ov.clips);
2727 kfree(fh->ov.clips);
2728 fh->ov.clips = NULL; 2726 fh->ov.clips = NULL;
2729 fh->ov.nclips = 0; 2727 fh->ov.nclips = 0;
2730 2728
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index 59bb71381a1b..d679ca23ded7 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -1006,10 +1006,8 @@ v4l_compat_translate_ioctl(struct inode *inode,
1006 break; 1006 break;
1007 } 1007 }
1008 1008
1009 if (cap2) 1009 kfree(cap2);
1010 kfree(cap2); 1010 kfree(fmt2);
1011 if (fmt2)
1012 kfree(fmt2);
1013 return err; 1011 return err;
1014} 1012}
1015 1013
diff --git a/drivers/media/video/videocodec.c b/drivers/media/video/videocodec.c
index c9d5f1a873cc..839db622040d 100644
--- a/drivers/media/video/videocodec.c
+++ b/drivers/media/video/videocodec.c
@@ -353,8 +353,7 @@ videocodec_build_table (void)
353 dprintk(3, "videocodec_build table: %d entries, %d bytes\n", i, 353 dprintk(3, "videocodec_build table: %d entries, %d bytes\n", i,
354 size); 354 size);
355 355
356 if (videocodec_buf) 356 kfree(videocodec_buf);
357 kfree(videocodec_buf);
358 videocodec_buf = (char *) kmalloc(size, GFP_KERNEL); 357 videocodec_buf = (char *) kmalloc(size, GFP_KERNEL);
359 358
360 i = 0; 359 i = 0;
@@ -471,8 +470,7 @@ videocodec_exit (void)
471{ 470{
472#ifdef CONFIG_PROC_FS 471#ifdef CONFIG_PROC_FS
473 remove_proc_entry("videocodecs", NULL); 472 remove_proc_entry("videocodecs", NULL);
474 if (videocodec_buf) 473 kfree(videocodec_buf);
475 kfree(videocodec_buf);
476#endif 474#endif
477} 475}
478 476
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 06df15f75de9..83c49f9610d0 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -215,8 +215,7 @@ video_usercopy(struct inode *inode, struct file *file,
215 } 215 }
216 216
217out: 217out:
218 if (mbuf) 218 kfree(mbuf);
219 kfree(mbuf);
220 return err; 219 return err;
221} 220}
222 221
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
index eed2acea1779..39a0d238900e 100644
--- a/drivers/media/video/zoran_card.c
+++ b/drivers/media/video/zoran_card.c
@@ -1057,10 +1057,8 @@ zr36057_init (struct zoran *zr)
1057 KERN_ERR 1057 KERN_ERR
1058 "%s: zr36057_init() - kmalloc (STAT_COM) failed\n", 1058 "%s: zr36057_init() - kmalloc (STAT_COM) failed\n",
1059 ZR_DEVNAME(zr)); 1059 ZR_DEVNAME(zr));
1060 if (vdev) 1060 kfree(vdev);
1061 kfree(vdev); 1061 kfree((void *)mem);
1062 if (mem)
1063 kfree((void *)mem);
1064 return -ENOMEM; 1062 return -ENOMEM;
1065 } 1063 }
1066 memset((void *) mem, 0, mem_needed); 1064 memset((void *) mem, 0, mem_needed);
@@ -1105,15 +1103,15 @@ zoran_release (struct zoran *zr)
1105 /* unregister videocodec bus */ 1103 /* unregister videocodec bus */
1106 if (zr->codec) { 1104 if (zr->codec) {
1107 struct videocodec_master *master = zr->codec->master_data; 1105 struct videocodec_master *master = zr->codec->master_data;
1106
1108 videocodec_detach(zr->codec); 1107 videocodec_detach(zr->codec);
1109 if (master) 1108 kfree(master);
1110 kfree(master);
1111 } 1109 }
1112 if (zr->vfe) { 1110 if (zr->vfe) {
1113 struct videocodec_master *master = zr->vfe->master_data; 1111 struct videocodec_master *master = zr->vfe->master_data;
1112
1114 videocodec_detach(zr->vfe); 1113 videocodec_detach(zr->vfe);
1115 if (master) 1114 kfree(master);
1116 kfree(master);
1117 } 1115 }
1118 1116
1119 /* unregister i2c bus */ 1117 /* unregister i2c bus */