Commit 2b3d0457 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

[media] V4L: omap1-camera: fix Oops with NULL platform data

Consistently check for platform data != NULL before dereferencing.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6ac939c0
...@@ -1579,10 +1579,10 @@ static int __init omap1_cam_probe(struct platform_device *pdev) ...@@ -1579,10 +1579,10 @@ static int __init omap1_cam_probe(struct platform_device *pdev)
pcdev->clk = clk; pcdev->clk = clk;
pcdev->pdata = pdev->dev.platform_data; pcdev->pdata = pdev->dev.platform_data;
if (pcdev->pdata) {
pcdev->pflags = pcdev->pdata->flags; pcdev->pflags = pcdev->pdata->flags;
if (pcdev->pdata)
pcdev->camexclk = pcdev->pdata->camexclk_khz * 1000; pcdev->camexclk = pcdev->pdata->camexclk_khz * 1000;
}
switch (pcdev->camexclk) { switch (pcdev->camexclk) {
case 6000000: case 6000000:
...@@ -1592,6 +1592,7 @@ static int __init omap1_cam_probe(struct platform_device *pdev) ...@@ -1592,6 +1592,7 @@ static int __init omap1_cam_probe(struct platform_device *pdev)
case 24000000: case 24000000:
break; break;
default: default:
/* pcdev->camexclk != 0 => pcdev->pdata != NULL */
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"Incorrect sensor clock frequency %ld kHz, " "Incorrect sensor clock frequency %ld kHz, "
"should be one of 0, 6, 8, 9.6, 12 or 24 MHz, " "should be one of 0, 6, 8, 9.6, 12 or 24 MHz, "
...@@ -1599,8 +1600,7 @@ static int __init omap1_cam_probe(struct platform_device *pdev) ...@@ -1599,8 +1600,7 @@ static int __init omap1_cam_probe(struct platform_device *pdev)
pcdev->pdata->camexclk_khz); pcdev->pdata->camexclk_khz);
pcdev->camexclk = 0; pcdev->camexclk = 0;
case 0: case 0:
dev_info(&pdev->dev, dev_info(&pdev->dev, "Not providing sensor clock\n");
"Not providing sensor clock\n");
} }
INIT_LIST_HEAD(&pcdev->capture); INIT_LIST_HEAD(&pcdev->capture);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment