]> err.no Git - linux-2.6/commitdiff
[PATCH] kfree cleanup: drivers/media
authorJesper Juhl <jesper.juhl@gmail.com>
Mon, 7 Nov 2005 09:01:31 +0000 (01:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:54:04 +0000 (07:54 -0800)
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>
12 files changed:
drivers/media/dvb/bt8xx/dst.c
drivers/media/dvb/frontends/dvb_dummy_fe.c
drivers/media/dvb/frontends/l64781.c
drivers/media/dvb/frontends/lgdt330x.c
drivers/media/dvb/frontends/mt312.c
drivers/media/dvb/frontends/or51132.c
drivers/media/video/arv.c
drivers/media/video/bttv-driver.c
drivers/media/video/v4l1-compat.c
drivers/media/video/videocodec.c
drivers/media/video/videodev.c
drivers/media/video/zoran_card.c

index 34a837a1abf4f1d5beeef0dd0dec301eba984d87..b3c9d7327ac1d4228a2eecc810bf6e98df75d172 100644 (file)
@@ -1331,9 +1331,7 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad
 {
        /* check if the ASIC is there */
        if (dst_probe(state) < 0) {
-               if (state)
-                       kfree(state);
-
+               kfree(state);
                return NULL;
        }
        /* determine settings based on type */
@@ -1349,9 +1347,7 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad
                break;
        default:
                dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist.");
-               if (state)
-                       kfree(state);
-
+               kfree(state);
                return NULL;
        }
 
index 794be520d5902fdad363d1a44486a76d9f5ecafc..645946a992d94b1dda65bf33e14561238ee6329f 100644 (file)
@@ -148,7 +148,7 @@ struct dvb_frontend* dvb_dummy_fe_qpsk_attach()
        return &state->frontend;
 
 error:
-       if (state) kfree(state);
+       kfree(state);
        return NULL;
 }
 
@@ -171,7 +171,7 @@ struct dvb_frontend* dvb_dummy_fe_qam_attach()
        return &state->frontend;
 
 error:
-       if (state) kfree(state);
+       kfree(state);
        return NULL;
 }
 
index faaad1ae85594bbfa4a205c3638baa0c6399e12d..19b4bf7c21a752eed6fa9c390ba803826bb1e59c 100644 (file)
@@ -559,7 +559,8 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
        return &state->frontend;
 
 error:
-       if (reg0x3e >= 0) l64781_writereg (state, 0x3e, reg0x3e);  /* restore reg 0x3e */
+       if (reg0x3e >= 0)
+               l64781_writereg (state, 0x3e, reg0x3e);  /* restore reg 0x3e */
        kfree(state);
        return NULL;
 }
index 8dde72bd10461fb5997cf13e6748e73bfee43535..7852b83b82d44737413cd013ff657b8afc0cfc7c 100644 (file)
@@ -731,8 +731,7 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
        return &state->frontend;
 
 error:
-       if (state)
-               kfree(state);
+       kfree(state);
        dprintk("%s: ERROR\n",__FUNCTION__);
        return NULL;
 }
index e38454901dd12e31d281a9e2ec9d1210534ae43d..9c67f406d581a7d9a7fe7d964bd1786492ad8c9d 100644 (file)
@@ -677,8 +677,7 @@ struct dvb_frontend* mt312_attach(const struct mt312_config* config,
        return &state->frontend;
 
 error:
-       if (state)
-               kfree(state);
+       kfree(state);
        return NULL;
 }
 
index 817b044c7fd1dd992898b6d680d62426d572729f..fc74c40d64777a500ae7748fde5e06bfdb11a7bd 100644 (file)
@@ -577,8 +577,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
        return &state->frontend;
 
 error:
-       if (state)
-               kfree(state);
+       kfree(state);
        return NULL;
 }
 
index 87fd3a7bb392cfc9a4bb7b9fc0a01cc79c677f8c..0823ddaf70049a0daa625196da95b80662f49fe0 100644 (file)
@@ -865,10 +865,8 @@ out_dev:
 
 out_irq:
 #endif
-       for (i = 0; i < MAX_AR_HEIGHT; i++) {
-               if (ar->frame[i])
-                       kfree(ar->frame[i]);
-       }
+       for (i = 0; i < MAX_AR_HEIGHT; i++)
+               kfree(ar->frame[i]);
 
 out_line_buff:
 #if USE_INT
@@ -899,10 +897,8 @@ static void __exit ar_cleanup_module(void)
 #if USE_INT
        free_irq(M32R_IRQ_INT3, ar);
 #endif
-       for (i = 0; i < MAX_AR_HEIGHT; i++) {
-               if (ar->frame[i])
-                       kfree(ar->frame[i]);
-       }
+       for (i = 0; i < MAX_AR_HEIGHT; i++)
+               kfree(ar->frame[i]);
 #if USE_INT
        kfree(ar->line_buff);
 #endif
index c062a017491e4bb08bf8c853d265b349ed464c59..d538a994ff04da1d68bcfe9ddc5023671c53d1a8 100644 (file)
@@ -1951,8 +1951,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
        }
 
        down(&fh->cap.lock);
-       if (fh->ov.clips)
-               kfree(fh->ov.clips);
+       kfree(fh->ov.clips);
        fh->ov.clips    = clips;
        fh->ov.nclips   = n;
 
@@ -2723,8 +2722,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
                        fh->ov.w.height = fb->fmt.height;
                        btv->init.ov.w.width  = fb->fmt.width;
                        btv->init.ov.w.height = fb->fmt.height;
-                       if (fh->ov.clips)
-                               kfree(fh->ov.clips);
+                       kfree(fh->ov.clips);
                        fh->ov.clips = NULL;
                        fh->ov.nclips = 0;
 
index 59bb71381a1b19f18877348fee0561a8215efba3..d679ca23ded71aac49e7ea70f229e40137ddd300 100644 (file)
@@ -1006,10 +1006,8 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                break;
        }
 
-       if (cap2)
-               kfree(cap2);
-       if (fmt2)
-               kfree(fmt2);
+       kfree(cap2);
+       kfree(fmt2);
        return err;
 }
 
index c9d5f1a873cc094474033143a8c4937a4dbc7987..839db622040dcdcfe1ff344d7f8846b5c9a7ef53 100644 (file)
@@ -353,8 +353,7 @@ videocodec_build_table (void)
        dprintk(3, "videocodec_build table: %d entries, %d bytes\n", i,
                size);
 
-       if (videocodec_buf)
-               kfree(videocodec_buf);
+       kfree(videocodec_buf);
        videocodec_buf = (char *) kmalloc(size, GFP_KERNEL);
 
        i = 0;
@@ -471,8 +470,7 @@ videocodec_exit (void)
 {
 #ifdef CONFIG_PROC_FS
        remove_proc_entry("videocodecs", NULL);
-       if (videocodec_buf)
-               kfree(videocodec_buf);
+       kfree(videocodec_buf);
 #endif
 }
 
index 06df15f75de94d2fdf34268fd799737e99d7c5d1..83c49f9610d0b0bff75209c556eed46062f01d70 100644 (file)
@@ -215,8 +215,7 @@ video_usercopy(struct inode *inode, struct file *file,
        }
 
 out:
-       if (mbuf)
-               kfree(mbuf);
+       kfree(mbuf);
        return err;
 }
 
index eed2acea17791305a94965ab63020b7f9d41459f..39a0d238900e63f26c34992944b73a441e66b8f4 100644 (file)
@@ -1057,10 +1057,8 @@ zr36057_init (struct zoran *zr)
                        KERN_ERR
                        "%s: zr36057_init() - kmalloc (STAT_COM) failed\n",
                        ZR_DEVNAME(zr));
-               if (vdev)
-                       kfree(vdev);
-               if (mem)
-                       kfree((void *)mem);
+               kfree(vdev);
+               kfree((void *)mem);
                return -ENOMEM;
        }
        memset((void *) mem, 0, mem_needed);
@@ -1105,15 +1103,15 @@ zoran_release (struct zoran *zr)
        /* unregister videocodec bus */
        if (zr->codec) {
                struct videocodec_master *master = zr->codec->master_data;
+
                videocodec_detach(zr->codec);
-               if (master)
-                       kfree(master);
+               kfree(master);
        }
        if (zr->vfe) {
                struct videocodec_master *master = zr->vfe->master_data;
+
                videocodec_detach(zr->vfe);
-               if (master)
-                       kfree(master);
+               kfree(master);
        }
 
        /* unregister i2c bus */