summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/soc_camera
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-03-12 15:40:37 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 21:19:03 +0400
commit4a1313c447ffb67125802d20653959ac46b0b4ef (patch)
tree4aedfedf5e1a62f4a7ffad2fba416153fe21d322 /drivers/media/i2c/soc_camera
parentcbaa5c54cb73897ed6c2544a60ed52aa3215b0f6 (diff)
downloadlinux-4a1313c447ffb67125802d20653959ac46b0b4ef.tar.xz
[media] mt9m111: fix Oops - initialise context before dereferencing
A recent commit "[media] soc-camera: Push probe-time power management to drivers" causes an Oops during mt9m111 driver probing because its .ctx private data field is now dereferenced before it is initialised. Fix this by initialising the field earlier. Reported-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Tested-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/soc_camera')
-rw-r--r--drivers/media/i2c/soc_camera/mt9m111.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c
index 0b0ebaa68602..2902ba633da6 100644
--- a/drivers/media/i2c/soc_camera/mt9m111.c
+++ b/drivers/media/i2c/soc_camera/mt9m111.c
@@ -785,8 +785,6 @@ static int mt9m111_init(struct mt9m111 *mt9m111)
struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev);
int ret;
- /* Default HIGHPOWER context */
- mt9m111->ctx = &context_b;
ret = mt9m111_enable(mt9m111);
if (!ret)
ret = mt9m111_reset(mt9m111);
@@ -975,6 +973,9 @@ static int mt9m111_probe(struct i2c_client *client,
if (!mt9m111)
return -ENOMEM;
+ /* Default HIGHPOWER context */
+ mt9m111->ctx = &context_b;
+
v4l2_i2c_subdev_init(&mt9m111->subdev, client, &mt9m111_subdev_ops);
v4l2_ctrl_handler_init(&mt9m111->hdl, 5);
v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops,