aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2011-12-13 03:44:42 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-06 08:48:22 -0500
commitd2f7a1a2467c01b569d2a7fbf10e8894a3f0e496 (patch)
treef5037f17ea9219456c4608fc4a5af8a3dcb2ddb3 /drivers
parentbb0a896e3d50833a43f94264ec8e66900b796b8b (diff)
[media] vpif_capture.c: v4l2_device_register() is called too late in vpif_probe()
The function v4l2_device_register() is called too late in vpif_probe(). This meant that vpif_obj.v4l2_dev is accessed before it is initialized which caused a crash. This used to work in the past, but video_register_device() is now actually using the v4l2_dev pointer. Note that vpif_display.c doesn't have this bug, there v4l2_device_register() is called at the beginning of vpif_probe. Signed-off-by: Georgios Plakaris <gplakari@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Manjunath Hadli <Manjunath.hadli@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/davinci/vpif_capture.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c
index 49e4deb50043..6504e40a31dd 100644
--- a/drivers/media/video/davinci/vpif_capture.c
+++ b/drivers/media/video/davinci/vpif_capture.c
@@ -2177,6 +2177,12 @@ static __init int vpif_probe(struct platform_device *pdev)
2177 return err; 2177 return err;
2178 } 2178 }
2179 2179
2180 err = v4l2_device_register(vpif_dev, &vpif_obj.v4l2_dev);
2181 if (err) {
2182 v4l2_err(vpif_dev->driver, "Error registering v4l2 device\n");
2183 return err;
2184 }
2185
2180 k = 0; 2186 k = 0;
2181 while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, k))) { 2187 while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, k))) {
2182 for (i = res->start; i <= res->end; i++) { 2188 for (i = res->start; i <= res->end; i++) {
@@ -2246,12 +2252,6 @@ static __init int vpif_probe(struct platform_device *pdev)
2246 goto probe_out; 2252 goto probe_out;
2247 } 2253 }
2248 2254
2249 err = v4l2_device_register(vpif_dev, &vpif_obj.v4l2_dev);
2250 if (err) {
2251 v4l2_err(vpif_dev->driver, "Error registering v4l2 device\n");
2252 goto probe_subdev_out;
2253 }
2254
2255 for (i = 0; i < subdev_count; i++) { 2255 for (i = 0; i < subdev_count; i++) {
2256 subdevdata = &config->subdev_info[i]; 2256 subdevdata = &config->subdev_info[i];
2257 vpif_obj.sd[i] = 2257 vpif_obj.sd[i] =
@@ -2281,7 +2281,6 @@ probe_subdev_out:
2281 2281
2282 j = VPIF_CAPTURE_MAX_DEVICES; 2282 j = VPIF_CAPTURE_MAX_DEVICES;
2283probe_out: 2283probe_out:
2284 v4l2_device_unregister(&vpif_obj.v4l2_dev);
2285 for (k = 0; k < j; k++) { 2284 for (k = 0; k < j; k++) {
2286 /* Get the pointer to the channel object */ 2285 /* Get the pointer to the channel object */
2287 ch = vpif_obj.dev[k]; 2286 ch = vpif_obj.dev[k];
@@ -2303,6 +2302,7 @@ vpif_int_err:
2303 if (res) 2302 if (res)
2304 i = res->end; 2303 i = res->end;
2305 } 2304 }
2305 v4l2_device_unregister(&vpif_obj.v4l2_dev);
2306 return err; 2306 return err;
2307} 2307}
2308 2308