summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/video/mxc/mxc_epdc_fb.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/video/mxc/mxc_epdc_fb.c b/drivers/video/mxc/mxc_epdc_fb.c
index 7a49cd980353..07c8d147d63a 100644
--- a/drivers/video/mxc/mxc_epdc_fb.c
+++ b/drivers/video/mxc/mxc_epdc_fb.c
@@ -2404,9 +2404,11 @@ int __devinit mxc_epdc_fb_probe(struct platform_device *pdev)
goto out;
}
- /* Get platform data */
+ /* Get platform data and check validity */
fb_data->pdata = pdev->dev.platform_data;
- if ((fb_data->pdata == NULL) || (fb_data->pdata->num_modes < 1)) {
+ if ((fb_data->pdata == NULL) || (fb_data->pdata->num_modes < 1)
+ || (fb_data->pdata->epdc_mode == NULL)
+ || (fb_data->pdata->epdc_mode->vmode == NULL)) {
ret = -EINVAL;
goto out_fbdata;
}
@@ -2436,12 +2438,14 @@ int __devinit mxc_epdc_fb_probe(struct platform_device *pdev)
/* Set default (first defined mode) before searching for a match */
fb_data->cur_mode = &fb_data->pdata->epdc_mode[0];
- for (i = 0; i < fb_data->pdata->num_modes; i++)
- if (!strcmp(fb_data->pdata->epdc_mode[i].vmode->name,
- panel_str)) {
- fb_data->cur_mode = &fb_data->pdata->epdc_mode[i];
- break;
- }
+ if (panel_str)
+ for (i = 0; i < fb_data->pdata->num_modes; i++)
+ if (!strcmp(fb_data->pdata->epdc_mode[i].vmode->name,
+ panel_str)) {
+ fb_data->cur_mode =
+ &fb_data->pdata->epdc_mode[i];
+ break;
+ }
vmode = fb_data->cur_mode->vmode;