Commit a31ffe93 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

media: rcar-vin: unregister video device on driver removal

If the video device was registered by the complete() callback it should
be unregistered when a device is unbound from the driver. Protect from
printing an uninitialized video device node name by adding a check in
rvin_v4l2_unregister() to identify that the video device is registered.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent d6ad012e
...@@ -272,6 +272,8 @@ static int rcar_vin_remove(struct platform_device *pdev) ...@@ -272,6 +272,8 @@ static int rcar_vin_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
rvin_v4l2_unregister(vin);
v4l2_async_notifier_unregister(&vin->notifier); v4l2_async_notifier_unregister(&vin->notifier);
v4l2_async_notifier_cleanup(&vin->notifier); v4l2_async_notifier_cleanup(&vin->notifier);
......
...@@ -841,6 +841,9 @@ static const struct v4l2_file_operations rvin_fops = { ...@@ -841,6 +841,9 @@ static const struct v4l2_file_operations rvin_fops = {
void rvin_v4l2_unregister(struct rvin_dev *vin) void rvin_v4l2_unregister(struct rvin_dev *vin)
{ {
if (!video_is_registered(&vin->vdev))
return;
v4l2_info(&vin->v4l2_dev, "Removing %s\n", v4l2_info(&vin->v4l2_dev, "Removing %s\n",
video_device_node_name(&vin->vdev)); video_device_node_name(&vin->vdev));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment