diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index 3c8bc75e4d6c..f35c514a420a 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -1053,6 +1053,11 @@ static int dvb_demux_do_ioctl(struct file *file, if (mutex_lock_interruptible(&dmxdev->mutex)) return -ERESTARTSYS; + if (dmxdev->exit) { + mutex_unlock(&dmxdev->mutex); + return -ENODEV; + } + switch (cmd) { case DMX_START: if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { diff --git a/drivers/media/usb/as102/as102_drv.c b/drivers/media/usb/as102/as102_drv.c index 6b1d3528a0a7..9a6e554ba9d9 100644 --- a/drivers/media/usb/as102/as102_drv.c +++ b/drivers/media/usb/as102/as102_drv.c @@ -322,6 +322,9 @@ int as102_dvb_register(struct as102_dev_t *as102_dev) goto edmxdinit; } + /* init start / stop stream mutex */ + mutex_init(&as102_dev->sem); + /* Attach the frontend */ as102_dev->dvb_fe = dvb_attach(as102_attach, as102_dev->name, &as102_fe_ops, @@ -344,9 +347,6 @@ int as102_dvb_register(struct as102_dev_t *as102_dev) /* init bus mutex for token locking */ mutex_init(&as102_dev->bus_adap.lock); - /* init start / stop stream mutex */ - mutex_init(&as102_dev->sem); - /* * try to load as102 firmware. If firmware upload failed, we'll be * able to upload it later.