Commit 2ea75330 authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

[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: default avatarJesper 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: default avatarAndreas Oberritter <obi@linuxtv.org>
Acked-by: default avatarWilson Michaels <wilsonmichaels@earthlink.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 17fd682e
...@@ -1331,9 +1331,7 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad ...@@ -1331,9 +1331,7 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad
{ {
/* check if the ASIC is there */ /* check if the ASIC is there */
if (dst_probe(state) < 0) { if (dst_probe(state) < 0) {
if (state) kfree(state);
kfree(state);
return NULL; return NULL;
} }
/* determine settings based on type */ /* determine settings based on type */
...@@ -1349,9 +1347,7 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad ...@@ -1349,9 +1347,7 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad
break; break;
default: default:
dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist."); dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist.");
if (state) kfree(state);
kfree(state);
return NULL; return NULL;
} }
......
...@@ -148,7 +148,7 @@ struct dvb_frontend* dvb_dummy_fe_qpsk_attach() ...@@ -148,7 +148,7 @@ struct dvb_frontend* dvb_dummy_fe_qpsk_attach()
return &state->frontend; return &state->frontend;
error: error:
if (state) kfree(state); kfree(state);
return NULL; return NULL;
} }
...@@ -171,7 +171,7 @@ struct dvb_frontend* dvb_dummy_fe_qam_attach() ...@@ -171,7 +171,7 @@ struct dvb_frontend* dvb_dummy_fe_qam_attach()
return &state->frontend; return &state->frontend;
error: error:
if (state) kfree(state); kfree(state);
return NULL; return NULL;
} }
......
...@@ -559,7 +559,8 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, ...@@ -559,7 +559,8 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
return &state->frontend; return &state->frontend;
error: 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); kfree(state);
return NULL; return NULL;
} }
......
...@@ -731,8 +731,7 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, ...@@ -731,8 +731,7 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
return &state->frontend; return &state->frontend;
error: error:
if (state) kfree(state);
kfree(state);
dprintk("%s: ERROR\n",__FUNCTION__); dprintk("%s: ERROR\n",__FUNCTION__);
return NULL; return NULL;
} }
......
...@@ -677,8 +677,7 @@ struct dvb_frontend* mt312_attach(const struct mt312_config* config, ...@@ -677,8 +677,7 @@ struct dvb_frontend* mt312_attach(const struct mt312_config* config,
return &state->frontend; return &state->frontend;
error: error:
if (state) kfree(state);
kfree(state);
return NULL; return NULL;
} }
......
...@@ -577,8 +577,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config, ...@@ -577,8 +577,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
return &state->frontend; return &state->frontend;
error: error:
if (state) kfree(state);
kfree(state);
return NULL; return NULL;
} }
......
...@@ -865,10 +865,8 @@ static int __init ar_init(void) ...@@ -865,10 +865,8 @@ static int __init ar_init(void)
out_irq: out_irq:
#endif #endif
for (i = 0; i < MAX_AR_HEIGHT; i++) { for (i = 0; i < MAX_AR_HEIGHT; i++)
if (ar->frame[i]) kfree(ar->frame[i]);
kfree(ar->frame[i]);
}
out_line_buff: out_line_buff:
#if USE_INT #if USE_INT
...@@ -899,10 +897,8 @@ static void __exit ar_cleanup_module(void) ...@@ -899,10 +897,8 @@ static void __exit ar_cleanup_module(void)
#if USE_INT #if USE_INT
free_irq(M32R_IRQ_INT3, ar); free_irq(M32R_IRQ_INT3, ar);
#endif #endif
for (i = 0; i < MAX_AR_HEIGHT; i++) { for (i = 0; i < MAX_AR_HEIGHT; i++)
if (ar->frame[i]) kfree(ar->frame[i]);
kfree(ar->frame[i]);
}
#if USE_INT #if USE_INT
kfree(ar->line_buff); kfree(ar->line_buff);
#endif #endif
......
...@@ -1951,8 +1951,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, ...@@ -1951,8 +1951,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
} }
down(&fh->cap.lock); down(&fh->cap.lock);
if (fh->ov.clips) kfree(fh->ov.clips);
kfree(fh->ov.clips);
fh->ov.clips = clips; fh->ov.clips = clips;
fh->ov.nclips = n; fh->ov.nclips = n;
...@@ -2723,8 +2722,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2723,8 +2722,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
fh->ov.w.height = fb->fmt.height; fh->ov.w.height = fb->fmt.height;
btv->init.ov.w.width = fb->fmt.width; btv->init.ov.w.width = fb->fmt.width;
btv->init.ov.w.height = fb->fmt.height; 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.clips = NULL;
fh->ov.nclips = 0; fh->ov.nclips = 0;
......
...@@ -1006,10 +1006,8 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -1006,10 +1006,8 @@ v4l_compat_translate_ioctl(struct inode *inode,
break; break;
} }
if (cap2) kfree(cap2);
kfree(cap2); kfree(fmt2);
if (fmt2)
kfree(fmt2);
return err; return err;
} }
......
...@@ -353,8 +353,7 @@ videocodec_build_table (void) ...@@ -353,8 +353,7 @@ videocodec_build_table (void)
dprintk(3, "videocodec_build table: %d entries, %d bytes\n", i, dprintk(3, "videocodec_build table: %d entries, %d bytes\n", i,
size); size);
if (videocodec_buf) kfree(videocodec_buf);
kfree(videocodec_buf);
videocodec_buf = (char *) kmalloc(size, GFP_KERNEL); videocodec_buf = (char *) kmalloc(size, GFP_KERNEL);
i = 0; i = 0;
...@@ -471,8 +470,7 @@ videocodec_exit (void) ...@@ -471,8 +470,7 @@ videocodec_exit (void)
{ {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
remove_proc_entry("videocodecs", NULL); remove_proc_entry("videocodecs", NULL);
if (videocodec_buf) kfree(videocodec_buf);
kfree(videocodec_buf);
#endif #endif
} }
......
...@@ -215,8 +215,7 @@ video_usercopy(struct inode *inode, struct file *file, ...@@ -215,8 +215,7 @@ video_usercopy(struct inode *inode, struct file *file,
} }
out: out:
if (mbuf) kfree(mbuf);
kfree(mbuf);
return err; return err;
} }
......
...@@ -1057,10 +1057,8 @@ zr36057_init (struct zoran *zr) ...@@ -1057,10 +1057,8 @@ zr36057_init (struct zoran *zr)
KERN_ERR KERN_ERR
"%s: zr36057_init() - kmalloc (STAT_COM) failed\n", "%s: zr36057_init() - kmalloc (STAT_COM) failed\n",
ZR_DEVNAME(zr)); ZR_DEVNAME(zr));
if (vdev) kfree(vdev);
kfree(vdev); kfree((void *)mem);
if (mem)
kfree((void *)mem);
return -ENOMEM; return -ENOMEM;
} }
memset((void *) mem, 0, mem_needed); memset((void *) mem, 0, mem_needed);
...@@ -1105,15 +1103,15 @@ zoran_release (struct zoran *zr) ...@@ -1105,15 +1103,15 @@ zoran_release (struct zoran *zr)
/* unregister videocodec bus */ /* unregister videocodec bus */
if (zr->codec) { if (zr->codec) {
struct videocodec_master *master = zr->codec->master_data; struct videocodec_master *master = zr->codec->master_data;
videocodec_detach(zr->codec); videocodec_detach(zr->codec);
if (master) kfree(master);
kfree(master);
} }
if (zr->vfe) { if (zr->vfe) {
struct videocodec_master *master = zr->vfe->master_data; struct videocodec_master *master = zr->vfe->master_data;
videocodec_detach(zr->vfe); videocodec_detach(zr->vfe);
if (master) kfree(master);
kfree(master);
} }
/* unregister i2c bus */ /* unregister i2c bus */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment