diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index b6dc3327c51c8edb316328857a59e113f7726d1f..898fb9bd88a279db1cec20f44dc952eb4a721254 100644 --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c @@ -1099,12 +1099,10 @@ void em28xx_close_extension(struct em28xx *dev) const struct em28xx_ops *ops = NULL; mutex_lock(&em28xx_devlist_mutex); - mutex_lock(&dev->lock); list_for_each_entry(ops, &em28xx_extension_devlist, next) { if (ops->fini) ops->fini(dev); } - mutex_unlock(&dev->lock); list_del(&dev->devlist); mutex_unlock(&em28xx_devlist_mutex); } diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 1486d47409738ccf4f9a4ed2697f12b3d3266399..aabcafbdab46cdc025b5fbbccca447c9631d22dd 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1896,6 +1896,8 @@ static int em28xx_v4l2_fini(struct em28xx *dev) em28xx_info("Closing video extension"); + mutex_lock(&dev->lock); + v4l2_device_disconnect(&dev->v4l2_dev); em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE); @@ -1926,6 +1928,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev) if (dev->users) em28xx_warn("Device is open ! Memory deallocation is deferred on last close.\n"); + mutex_unlock(&dev->lock); return 0; }