media_devnode_release calls a release callback. Currently none of the drivers implement that callback but in the future the vimc driver and maybe others might add implementation for it. The release callback will want to access the driver's private data by using 'container_of(devnode->media_dev' therefore media_dev should be set to NULL only when the release callback returns. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@xxxxxxxxxxxxx> --- drivers/media/mc/mc-devnode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/mc/mc-devnode.c b/drivers/media/mc/mc-devnode.c index f11382afe23b..388c9051152a 100644 --- a/drivers/media/mc/mc-devnode.c +++ b/drivers/media/mc/mc-devnode.c @@ -58,7 +58,7 @@ static void media_devnode_release(struct device *cd) /* Release media_devnode and perform other cleanups as needed. */ if (devnode->release) devnode->release(devnode); - + devnode->media_dev = NULL; kfree(devnode); pr_debug("%s: Media Devnode Deallocated\n", __func__); } @@ -283,7 +283,6 @@ void media_devnode_unregister(struct media_devnode *devnode) mutex_lock(&media_devnode_lock); /* Delete the cdev on this minor as well */ cdev_device_del(&devnode->cdev, &devnode->dev); - devnode->media_dev = NULL; mutex_unlock(&media_devnode_lock); put_device(&devnode->dev); -- 2.17.1