diff options
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index f53c989f6..36cd666f4 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -1442,7 +1442,11 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d printk ("av7110: Warning, firmware version 0x%04x is too old. " "System might be unstable!\n", FW_VERSION(av7110->arm_app)); - kernel_thread(arm_thread, (void *) av7110, 0); + if (kernel_thread(arm_thread, (void *) av7110, 0) < 0) { + printk(KERN_ERR "av7110(%d): faile to start arm_mon kernel thread\n", + av7110->dvb_adapter->num); + goto err2; + } /* set internal volume control to maximum */ av7110->adac_type = DVB_ADAC_TI; @@ -1500,32 +1504,35 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d ret = av7110_init_v4l(av7110); if (ret) - goto err; + goto err3; printk(KERN_INFO "av7110: found av7110-%d.\n", av7110_num); av7110->device_initialized = 1; av7110_num++; return 0; +err3: + av7110->arm_rmmod = 1; + wake_up_interruptible(&av7110->arm_wait); + while (av7110->arm_thread) + dvb_delay(1); err2: av7110_ca_exit(av7110); av7110_av_exit(av7110); err: - if (NULL != av7110 ) { - kfree(av7110); - } - if (NULL != av7110->debi_virt) { + dvb_unregister_i2c_bus(master_xfer, av7110->i2c_bus->adapter, + av7110->i2c_bus->id); + + dvb_unregister_adapter(av7110->dvb_adapter); + + if (NULL != av7110->debi_virt) pci_free_consistent(dev->pci, 8192, av7110->debi_virt, av7110->debi_bus); - } - if (NULL != av7110->iobuf) { + if (NULL != av7110->iobuf) vfree(av7110->iobuf); + if (NULL != av7110 ) { + kfree(av7110); } - dvb_unregister_i2c_bus (master_xfer,av7110->i2c_bus->adapter, - av7110->i2c_bus->id); - - dvb_unregister_adapter (av7110->dvb_adapter); - return ret; } |