diff options
author | Danny Nold <dannynold@freescale.com> | 2010-08-26 16:28:25 -0500 |
---|---|---|
committer | Danny Nold <dannynold@freescale.com> | 2010-08-26 16:35:13 -0500 |
commit | de51c3597c98a9b8f81fc3421f8feaec5f3cda2d (patch) | |
tree | 5dcfc890c3c87a56b227af59976b35eb7dc59c55 | |
parent | c06126a105021728e4c0f5771f444492e5999d28 (diff) |
ENGR00126739 - EPDC fb: driver crashes when no panel selected via command line.
Crash averted by preventing the case where a NULL string (representing
the panel selected via command line) is passed through strcmp().
If no command line panel selected, the default will be the first panel
defined in the platform data (the 6.0" E Ink panel for MX50 ARM2).
Signed-off-by: Danny Nold <dannynold@freescale.com>
-rw-r--r-- | drivers/video/mxc/mxc_epdc_fb.c | 20 |
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; |