diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 98cee19..541dba3 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -172,13 +172,14 @@ static void v4l2_device_release(struct device *cd) media_device_unregister_entity(&vdev->entity); #endif + /* Decrease v4l2_device refcount */ + if (vdev->v4l2_dev) + v4l2_device_put(vdev->v4l2_dev); + /* Release video_device and perform other cleanups as needed. */ vdev->release(vdev); - /* Decrease v4l2_device refcount */ - if (vdev->v4l2_dev) - v4l2_device_put(vdev->v4l2_dev); } static struct class video_class = {