diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c index f8ea7cfe10b2..039ef7d04ac7 100644 --- a/drivers/media/mc/mc-device.c +++ b/drivers/media/mc/mc-device.c @@ -674,7 +674,8 @@ void media_device_unregister_entity(struct media_entity *entity) return; mutex_lock(&mdev->graph_mutex); - __media_device_unregister_entity(entity); + if (entity->graph_obj.mdev) + __media_device_unregister_entity(entity); mutex_unlock(&mdev->graph_mutex); } EXPORT_SYMBOL_GPL(media_device_unregister_entity); diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 84424284d486..ec4ed2b0e5fd 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -3137,6 +3137,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) * v4l2_device refcount to zero. */ v4l2_device_put(&v4l2->v4l2_dev); + dev->v4l2 = NULL; return ret; }