From: Guennadi Liakhovetski Date: Tue, 30 Jul 2013 06:34:06 +0000 (-0300) Subject: [media] V4L2: mt9t031: don't Oops if asynchronous probing is attempted X-Git-Tag: upstream/snapshot3+hdmi~3461^2~720 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d238885dbfd5359cd0c12fad858e8638f17bfc6;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git [media] V4L2: mt9t031: don't Oops if asynchronous probing is attempted The mt9t031 driver hasn't yet been updated to support asynchronous subdevice probing. If such a probing is attempted, the driver is allowed to fail, but it shouldn't Oops. This patch fixes such a potential NULL pointer dereference. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/i2c/soc_camera/mt9t031.c b/drivers/media/i2c/soc_camera/mt9t031.c index 47d18d0..ee7bb0f 100644 --- a/drivers/media/i2c/soc_camera/mt9t031.c +++ b/drivers/media/i2c/soc_camera/mt9t031.c @@ -594,9 +594,12 @@ static int mt9t031_s_power(struct v4l2_subdev *sd, int on) ret = soc_camera_power_on(&client->dev, ssdd, mt9t031->clk); if (ret < 0) return ret; - vdev->dev.type = &mt9t031_dev_type; + if (vdev) + /* Not needed during probing, when vdev isn't available yet */ + vdev->dev.type = &mt9t031_dev_type; } else { - vdev->dev.type = NULL; + if (vdev) + vdev->dev.type = NULL; soc_camera_power_off(&client->dev, ssdd, mt9t031->clk); }