aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-03-23 04:26:11 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-04-13 08:55:06 -0400
commitc8dd707805af100965c93cdca7d61e61165e9c07 (patch)
tree3e52f277690e46a58b45cd4c6a9f715ef4c989b0 /drivers/media/video/soc_camera.c
parent3e31f2b9456d0777a41d9d26429d6f2ad6894014 (diff)
[media] soc-camera: don't dereference I2C client after it has been removed
i2c_unregister_device() frees the I2C client, so, dereferencing it afterwards is a bug, that leads to Oopses. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r--drivers/media/video/soc_camera.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 921993060d2f..3973f9a94753 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -996,10 +996,11 @@ static void soc_camera_free_i2c(struct soc_camera_device *icd)
996{ 996{
997 struct i2c_client *client = 997 struct i2c_client *client =
998 to_i2c_client(to_soc_camera_control(icd)); 998 to_i2c_client(to_soc_camera_control(icd));
999 struct i2c_adapter *adap = client->adapter;
999 dev_set_drvdata(&icd->dev, NULL); 1000 dev_set_drvdata(&icd->dev, NULL);
1000 v4l2_device_unregister_subdev(i2c_get_clientdata(client)); 1001 v4l2_device_unregister_subdev(i2c_get_clientdata(client));
1001 i2c_unregister_device(client); 1002 i2c_unregister_device(client);
1002 i2c_put_adapter(client->adapter); 1003 i2c_put_adapter(adap);
1003} 1004}
1004#else 1005#else
1005#define soc_camera_init_i2c(icd, icl) (-ENODEV) 1006#define soc_camera_init_i2c(icd, icl) (-ENODEV)