To avoid races between device access and unplug, call the video_device_unplug() function in the platform driver remove handler. This will unsure that all device access completes before the remove handler proceeds to free resources.
Signed-off-by: Laurent Pinchart <laurent.pinchart+rene...@ideasonboard.com> --- drivers/media/platform/rcar-vin/rcar-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index bd7976efa1fb..c5210f1d09ed 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -1273,6 +1273,7 @@ static int rcar_vin_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); + video_device_unplug(&vin->vdev); if (!vin->info->use_mc) { v4l2_async_notifier_unregister(&vin->notifier); -- Regards, Laurent Pinchart