提交 1a8dc86d 编写于 作者: D Darron Broad 提交者: Mauro Carvalho Chehab

V4L/DVB (9499): cx88-mpeg: final fix for analogue only compilation + de-alloc fix

Final fix for when analogue only is selected
for compilation (ie, !CX88_DVB)

This tidies up previous fix and adds missing
de-alloc memory leak on fault (eg, if fe1 fails to alloc
where fe0 was allocated).
Signed-off-by: NDarron Broad <darron@kewl.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 9c8e0a26
......@@ -769,10 +769,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
struct cx8802_dev *dev;
struct cx88_core *core;
int err;
#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
struct videobuf_dvb_frontend *demod;
int i;
#endif
/* general setup */
core = cx88_core_get(pci_dev);
......@@ -803,17 +799,23 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
mutex_init(&dev->frontends.lock);
INIT_LIST_HEAD(&dev->frontends.felist);
if (core->board.num_frontends)
printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends);
if (core->board.num_frontends) {
struct videobuf_dvb_frontend *fe;
int i;
printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
core->board.num_frontends);
for (i = 1; i <= core->board.num_frontends; i++) {
demod = videobuf_dvb_alloc_frontend(&dev->frontends, i);
if(demod == NULL) {
printk(KERN_ERR "%s() failed to alloc\n", __func__);
fe = videobuf_dvb_alloc_frontend(&dev->frontends, i);
if(fe == NULL) {
printk(KERN_ERR "%s() failed to alloc\n",
__func__);
videobuf_dvb_dealloc_frontends(&dev->frontends);
err = -ENOMEM;
goto fail_free;
}
}
}
#endif
/* Maintain a reference so cx88-video can query the 8802 device. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册