Commit 7bb151b2 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

[media] davinci_vpfe: Clean up media entity after unregistering subdev

media_entity_cleanup() frees the links array which will be accessed by
media_entity_remove_links() called by v4l2_device_unregister_subdev().
Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Reviewed-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e049ca5e
...@@ -1751,10 +1751,10 @@ static const struct media_entity_operations ipipe_media_ops = { ...@@ -1751,10 +1751,10 @@ static const struct media_entity_operations ipipe_media_ops = {
*/ */
void vpfe_ipipe_unregister_entities(struct vpfe_ipipe_device *vpfe_ipipe) void vpfe_ipipe_unregister_entities(struct vpfe_ipipe_device *vpfe_ipipe)
{ {
/* cleanup entity */
media_entity_cleanup(&vpfe_ipipe->subdev.entity);
/* unregister subdev */ /* unregister subdev */
v4l2_device_unregister_subdev(&vpfe_ipipe->subdev); v4l2_device_unregister_subdev(&vpfe_ipipe->subdev);
/* cleanup entity */
media_entity_cleanup(&vpfe_ipipe->subdev.entity);
} }
/* /*
......
...@@ -947,10 +947,10 @@ void vpfe_ipipeif_unregister_entities(struct vpfe_ipipeif_device *ipipeif) ...@@ -947,10 +947,10 @@ void vpfe_ipipeif_unregister_entities(struct vpfe_ipipeif_device *ipipeif)
/* unregister video device */ /* unregister video device */
vpfe_video_unregister(&ipipeif->video_in); vpfe_video_unregister(&ipipeif->video_in);
/* cleanup entity */
media_entity_cleanup(&ipipeif->subdev.entity);
/* unregister subdev */ /* unregister subdev */
v4l2_device_unregister_subdev(&ipipeif->subdev); v4l2_device_unregister_subdev(&ipipeif->subdev);
/* cleanup entity */
media_entity_cleanup(&ipipeif->subdev.entity);
} }
int int
......
...@@ -1750,10 +1750,10 @@ static const struct media_entity_operations isif_media_ops = { ...@@ -1750,10 +1750,10 @@ static const struct media_entity_operations isif_media_ops = {
void vpfe_isif_unregister_entities(struct vpfe_isif_device *isif) void vpfe_isif_unregister_entities(struct vpfe_isif_device *isif)
{ {
vpfe_video_unregister(&isif->video_out); vpfe_video_unregister(&isif->video_out);
/* cleanup entity */
media_entity_cleanup(&isif->subdev.entity);
/* unregister subdev */ /* unregister subdev */
v4l2_device_unregister_subdev(&isif->subdev); v4l2_device_unregister_subdev(&isif->subdev);
/* cleanup entity */
media_entity_cleanup(&isif->subdev.entity);
} }
static void isif_restore_defaults(struct vpfe_isif_device *isif) static void isif_restore_defaults(struct vpfe_isif_device *isif)
......
...@@ -1777,14 +1777,14 @@ void vpfe_resizer_unregister_entities(struct vpfe_resizer_device *vpfe_rsz) ...@@ -1777,14 +1777,14 @@ void vpfe_resizer_unregister_entities(struct vpfe_resizer_device *vpfe_rsz)
vpfe_video_unregister(&vpfe_rsz->resizer_a.video_out); vpfe_video_unregister(&vpfe_rsz->resizer_a.video_out);
vpfe_video_unregister(&vpfe_rsz->resizer_b.video_out); vpfe_video_unregister(&vpfe_rsz->resizer_b.video_out);
/* cleanup entity */
media_entity_cleanup(&vpfe_rsz->crop_resizer.subdev.entity);
media_entity_cleanup(&vpfe_rsz->resizer_a.subdev.entity);
media_entity_cleanup(&vpfe_rsz->resizer_b.subdev.entity);
/* unregister subdev */ /* unregister subdev */
v4l2_device_unregister_subdev(&vpfe_rsz->crop_resizer.subdev); v4l2_device_unregister_subdev(&vpfe_rsz->crop_resizer.subdev);
v4l2_device_unregister_subdev(&vpfe_rsz->resizer_a.subdev); v4l2_device_unregister_subdev(&vpfe_rsz->resizer_a.subdev);
v4l2_device_unregister_subdev(&vpfe_rsz->resizer_b.subdev); v4l2_device_unregister_subdev(&vpfe_rsz->resizer_b.subdev);
/* cleanup entity */
media_entity_cleanup(&vpfe_rsz->crop_resizer.subdev.entity);
media_entity_cleanup(&vpfe_rsz->resizer_a.subdev.entity);
media_entity_cleanup(&vpfe_rsz->resizer_b.subdev.entity);
} }
/* /*
...@@ -1865,12 +1865,12 @@ int vpfe_resizer_register_entities(struct vpfe_resizer_device *resizer, ...@@ -1865,12 +1865,12 @@ int vpfe_resizer_register_entities(struct vpfe_resizer_device *resizer,
vpfe_video_unregister(&resizer->resizer_b.video_out); vpfe_video_unregister(&resizer->resizer_b.video_out);
out_video_out2_register: out_video_out2_register:
vpfe_video_unregister(&resizer->resizer_a.video_out); vpfe_video_unregister(&resizer->resizer_a.video_out);
media_entity_cleanup(&resizer->crop_resizer.subdev.entity);
media_entity_cleanup(&resizer->resizer_a.subdev.entity);
media_entity_cleanup(&resizer->resizer_b.subdev.entity);
v4l2_device_unregister_subdev(&resizer->crop_resizer.subdev); v4l2_device_unregister_subdev(&resizer->crop_resizer.subdev);
v4l2_device_unregister_subdev(&resizer->resizer_a.subdev); v4l2_device_unregister_subdev(&resizer->resizer_a.subdev);
v4l2_device_unregister_subdev(&resizer->resizer_b.subdev); v4l2_device_unregister_subdev(&resizer->resizer_b.subdev);
media_entity_cleanup(&resizer->crop_resizer.subdev.entity);
media_entity_cleanup(&resizer->resizer_a.subdev.entity);
media_entity_cleanup(&resizer->resizer_b.subdev.entity);
return ret; return ret;
} }
......
...@@ -1614,7 +1614,7 @@ int vpfe_video_register(struct vpfe_video_device *video, ...@@ -1614,7 +1614,7 @@ int vpfe_video_register(struct vpfe_video_device *video,
void vpfe_video_unregister(struct vpfe_video_device *video) void vpfe_video_unregister(struct vpfe_video_device *video)
{ {
if (video_is_registered(&video->video_dev)) { if (video_is_registered(&video->video_dev)) {
media_entity_cleanup(&video->video_dev.entity);
video_unregister_device(&video->video_dev); video_unregister_device(&video->video_dev);
media_entity_cleanup(&video->video_dev.entity);
} }
} }
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