diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2015-03-25 18:57:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-02 15:39:14 -0400 |
commit | 4c8f14861cccb7b19cfd582e135847aa772f3854 (patch) | |
tree | d67a1d2af4831b9b1b6094852a2b853437ae347a | |
parent | 64904b574e33f897cc425fcbe64cebab92b3c6fb (diff) |
[media] omap3isp: Platform data could be NULL
Only check for call platform data callback functions if there's platform
data. Also take care of a few other cases where the NULL pdata pointer could
have been accessed, and remove the check for NULL dev->platform_data
pointer.
Removing the check for NULL dev->platform_data isn't strictly needed by the
DT support but there's no harm from that either: the device now can be used
without sensors, for instance.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/platform/omap3isp/isp.c | 10 | ||||
-rw-r--r-- | drivers/media/platform/omap3isp/ispvideo.c | 6 |
2 files changed, 7 insertions, 9 deletions
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 82499cd7c3d7..537377b43083 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c | |||
@@ -330,8 +330,8 @@ static int isp_xclk_init(struct isp_device *isp) | |||
330 | if (np) | 330 | if (np) |
331 | continue; | 331 | continue; |
332 | 332 | ||
333 | if (pdata->xclks[i].con_id == NULL && | 333 | if (!pdata || (pdata->xclks[i].con_id == NULL && |
334 | pdata->xclks[i].dev_id == NULL) | 334 | pdata->xclks[i].dev_id == NULL)) |
335 | continue; | 335 | continue; |
336 | 336 | ||
337 | xclk->lookup = kzalloc(sizeof(*xclk->lookup), GFP_KERNEL); | 337 | xclk->lookup = kzalloc(sizeof(*xclk->lookup), GFP_KERNEL); |
@@ -1989,7 +1989,8 @@ static int isp_register_entities(struct isp_device *isp) | |||
1989 | goto done; | 1989 | goto done; |
1990 | 1990 | ||
1991 | /* Register external entities */ | 1991 | /* Register external entities */ |
1992 | for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) { | 1992 | for (subdevs = pdata ? pdata->subdevs : NULL; |
1993 | subdevs && subdevs->subdevs; ++subdevs) { | ||
1993 | struct v4l2_subdev *sensor; | 1994 | struct v4l2_subdev *sensor; |
1994 | 1995 | ||
1995 | sensor = isp_register_subdev_group(isp, subdevs->subdevs); | 1996 | sensor = isp_register_subdev_group(isp, subdevs->subdevs); |
@@ -2271,9 +2272,6 @@ static int isp_probe(struct platform_device *pdev) | |||
2271 | int ret; | 2272 | int ret; |
2272 | int i, m; | 2273 | int i, m; |
2273 | 2274 | ||
2274 | if (pdata == NULL) | ||
2275 | return -EINVAL; | ||
2276 | |||
2277 | isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL); | 2275 | isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL); |
2278 | if (!isp) { | 2276 | if (!isp) { |
2279 | dev_err(&pdev->dev, "could not allocate memory\n"); | 2277 | dev_err(&pdev->dev, "could not allocate memory\n"); |
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index 0b5967ecd455..d285af18df7f 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c | |||
@@ -1018,7 +1018,7 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) | |||
1018 | 1018 | ||
1019 | pipe->entities = 0; | 1019 | pipe->entities = 0; |
1020 | 1020 | ||
1021 | if (video->isp->pdata->set_constraints) | 1021 | if (video->isp->pdata && video->isp->pdata->set_constraints) |
1022 | video->isp->pdata->set_constraints(video->isp, true); | 1022 | video->isp->pdata->set_constraints(video->isp, true); |
1023 | pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); | 1023 | pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); |
1024 | pipe->max_rate = pipe->l3_ick; | 1024 | pipe->max_rate = pipe->l3_ick; |
@@ -1100,7 +1100,7 @@ err_set_stream: | |||
1100 | err_check_format: | 1100 | err_check_format: |
1101 | media_entity_pipeline_stop(&video->video.entity); | 1101 | media_entity_pipeline_stop(&video->video.entity); |
1102 | err_pipeline_start: | 1102 | err_pipeline_start: |
1103 | if (video->isp->pdata->set_constraints) | 1103 | if (video->isp->pdata && video->isp->pdata->set_constraints) |
1104 | video->isp->pdata->set_constraints(video->isp, false); | 1104 | video->isp->pdata->set_constraints(video->isp, false); |
1105 | /* The DMA queue must be emptied here, otherwise CCDC interrupts that | 1105 | /* The DMA queue must be emptied here, otherwise CCDC interrupts that |
1106 | * will get triggered the next time the CCDC is powered up will try to | 1106 | * will get triggered the next time the CCDC is powered up will try to |
@@ -1161,7 +1161,7 @@ isp_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) | |||
1161 | video->queue = NULL; | 1161 | video->queue = NULL; |
1162 | video->error = false; | 1162 | video->error = false; |
1163 | 1163 | ||
1164 | if (video->isp->pdata->set_constraints) | 1164 | if (video->isp->pdata && video->isp->pdata->set_constraints) |
1165 | video->isp->pdata->set_constraints(video->isp, false); | 1165 | video->isp->pdata->set_constraints(video->isp, false); |
1166 | media_entity_pipeline_stop(&video->video.entity); | 1166 | media_entity_pipeline_stop(&video->video.entity); |
1167 | 1167 | ||