[media] V4L: soc_camera_platform: do not leave dangling invalid pointers
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Mon, 5 Sep 2011 16:50:27 +0000 (13:50 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 3 Nov 2011 20:28:45 +0000 (18:28 -0200)
The life-time of soc-camera device objects can be longer, than the
time, it is attached to a client driver, therefore all references to
the driver own data have to be cleared, when the driver is detached.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/soc_camera_platform.c

index f5ebe59a55552f251ea18f55c3c243fc63ee3abd..c8f6b188496dc7bcff99afaf317046526f4142d5 100644 (file)
@@ -173,7 +173,9 @@ evdrs:
 static int soc_camera_platform_remove(struct platform_device *pdev)
 {
        struct soc_camera_platform_priv *priv = get_priv(pdev);
+       struct soc_camera_platform_info *p = v4l2_get_subdevdata(&priv->subdev);
 
+       p->icd->control = NULL;
        v4l2_device_unregister_subdev(&priv->subdev);
        platform_set_drvdata(pdev, NULL);
        kfree(priv);