diff mbox

[RFC,2/2] davinci_vpfe: Clean up media entity after unregistering subdev

Message ID 1370947849-24314-2-git-send-email-sakari.ailus@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Sakari Ailus June 11, 2013, 10:50 a.m. UTC
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: Sakari Ailus <sakari.ailus@iki.fi>
---
 drivers/staging/media/davinci_vpfe/dm365_ipipe.c   |    4 ++--
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c |    4 ++--
 drivers/staging/media/davinci_vpfe/dm365_isif.c    |    4 ++--
 drivers/staging/media/davinci_vpfe/dm365_resizer.c |   14 +++++++-------
 drivers/staging/media/davinci_vpfe/vpfe_video.c    |    2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)

Comments

On 06/11/2013 12:50 PM, Sakari Ailus wrote:
> 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: Sakari Ailus <sakari.ailus@iki.fi>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lad, Prabhakar June 12, 2013, 4:44 a.m. UTC | #2
Hi Sakari,

Thanks for the patch.

On Tue, Jun 11, 2013 at 4:20 PM, Sakari Ailus <sakari.ailus@iki.fi> wrote:
> 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: Sakari Ailus <sakari.ailus@iki.fi>

Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sylwester Nawrocki June 16, 2013, 9:16 p.m. UTC | #3
Hi,

On 06/12/2013 06:44 AM, Prabhakar Lad wrote:
> On Tue, Jun 11, 2013 at 4:20 PM, Sakari Ailus<sakari.ailus@iki.fi>  wrote:
>> 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: Sakari Ailus<sakari.ailus@iki.fi>
>
> Acked-by: Lad, Prabhakar<prabhakar.csengg@gmail.com>

I have added these two patches to my tree for 3.11 (in branch for-v3.11-2).
Please let me know if you would like it to be handled differently.

Regards,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lad, Prabhakar June 17, 2013, 8:07 a.m. UTC | #4
Hi Sylwester,

On Mon, Jun 17, 2013 at 2:46 AM, Sylwester Nawrocki
<sylvester.nawrocki@gmail.com> wrote:
> Hi,
>
>
> On 06/12/2013 06:44 AM, Prabhakar Lad wrote:
>>
>> On Tue, Jun 11, 2013 at 4:20 PM, Sakari Ailus<sakari.ailus@iki.fi>  wrote:
>>>
>>> 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: Sakari Ailus<sakari.ailus@iki.fi>
>>
>>
>> Acked-by: Lad, Prabhakar<prabhakar.csengg@gmail.com>
>
>
> I have added these two patches to my tree for 3.11 (in branch for-v3.11-2).
> Please let me know if you would like it to be handled differently.
>
I am fine with it.

Regards,
--Prabhakar Lad
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sakari Ailus June 17, 2013, 8:43 p.m. UTC | #5
Hi Sylwester,

On Sun, Jun 16, 2013 at 11:16:44PM +0200, Sylwester Nawrocki wrote:
> Hi,
> 
> On 06/12/2013 06:44 AM, Prabhakar Lad wrote:
> >On Tue, Jun 11, 2013 at 4:20 PM, Sakari Ailus<sakari.ailus@iki.fi>  wrote:
> >>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: Sakari Ailus<sakari.ailus@iki.fi>
> >
> >Acked-by: Lad, Prabhakar<prabhakar.csengg@gmail.com>
> 
> I have added these two patches to my tree for 3.11 (in branch for-v3.11-2).
> Please let me know if you would like it to be handled differently.

This was what I was looking forward to. Thanks!
diff mbox

Patch

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 05673ed..766a071 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1751,10 +1751,10 @@  static const struct media_entity_operations ipipe_media_ops = {
  */
 void vpfe_ipipe_unregister_entities(struct vpfe_ipipe_device *vpfe_ipipe)
 {
-	/* cleanup entity */
-	media_entity_cleanup(&vpfe_ipipe->subdev.entity);
 	/* unregister subdev */
 	v4l2_device_unregister_subdev(&vpfe_ipipe->subdev);
+	/* cleanup entity */
+	media_entity_cleanup(&vpfe_ipipe->subdev.entity);
 }
 
 /*
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
index b2f4ef8..59540cd 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
@@ -947,10 +947,10 @@  void vpfe_ipipeif_unregister_entities(struct vpfe_ipipeif_device *ipipeif)
 	/* unregister video device */
 	vpfe_video_unregister(&ipipeif->video_in);
 
-	/* cleanup entity */
-	media_entity_cleanup(&ipipeif->subdev.entity);
 	/* unregister subdev */
 	v4l2_device_unregister_subdev(&ipipeif->subdev);
+	/* cleanup entity */
+	media_entity_cleanup(&ipipeif->subdev.entity);
 }
 
 int
diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c b/drivers/staging/media/davinci_vpfe/dm365_isif.c
index 5829360..ff48fce 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_isif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c
@@ -1750,10 +1750,10 @@  static const struct media_entity_operations isif_media_ops = {
 void vpfe_isif_unregister_entities(struct vpfe_isif_device *isif)
 {
 	vpfe_video_unregister(&isif->video_out);
-	/* cleanup entity */
-	media_entity_cleanup(&isif->subdev.entity);
 	/* unregister 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)
diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index 126f84c..8e13bd4 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -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_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 */
 	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_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 @@  out_create_link:
 	vpfe_video_unregister(&resizer->resizer_b.video_out);
 out_video_out2_register:
 	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->resizer_a.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;
 }
 
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index cb5410b..24d98a6 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -1614,7 +1614,7 @@  int vpfe_video_register(struct vpfe_video_device *video,
 void vpfe_video_unregister(struct vpfe_video_device *video)
 {
 	if (video_is_registered(&video->video_dev)) {
-		media_entity_cleanup(&video->video_dev.entity);
 		video_unregister_device(&video->video_dev);
+		media_entity_cleanup(&video->video_dev.entity);
 	}
 }