aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sh_mobile_meram.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-07-13 06:13:47 -0400
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-08-19 02:22:43 -0400
commit7963e21e50c8e712553347f900f0d0afaf5be2aa (patch)
tree70dc22f019cfd44ca5a6983503f32a5ef5de1bf7 /drivers/video/sh_mobile_meram.c
parentf0a260fef6943c60bae65ae52fc4fa52e7f078b1 (diff)
fbdev: sh_mobile_meram: Validate ICB configuration outside mutex
Validate as much of the requested ICB configuration as possible outside of the mutex-protected region when registering ICBs. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/video/sh_mobile_meram.c')
-rw-r--r--drivers/video/sh_mobile_meram.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
index 85577cf9ff58..25a7118a40f8 100644
--- a/drivers/video/sh_mobile_meram.c
+++ b/drivers/video/sh_mobile_meram.c
@@ -410,24 +410,22 @@ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
410 xres, yres, (!pixelformat) ? "yuv" : "rgb", 410 xres, yres, (!pixelformat) ? "yuv" : "rgb",
411 base_addr_y, base_addr_c); 411 base_addr_y, base_addr_c);
412 412
413 mutex_lock(&priv->lock);
414
415 /* we can't handle wider than 8192px */ 413 /* we can't handle wider than 8192px */
416 if (xres > 8192) { 414 if (xres > 8192) {
417 dev_err(&pdev->dev, "width exceeding the limit (> 8192)."); 415 dev_err(&pdev->dev, "width exceeding the limit (> 8192).");
418 error = -EINVAL; 416 return -EINVAL;
419 goto err;
420 }
421
422 if (priv->used_meram_cache_regions + 2 > SH_MOBILE_MERAM_ICB_NUM) {
423 dev_err(&pdev->dev, "no more ICB available.");
424 error = -EINVAL;
425 goto err;
426 } 417 }
427 418
428 /* do we have at least one ICB config? */ 419 /* do we have at least one ICB config? */
429 if (cfg->icb[0].marker_icb < 0 || cfg->icb[0].cache_icb < 0) { 420 if (cfg->icb[0].marker_icb < 0 || cfg->icb[0].cache_icb < 0) {
430 dev_err(&pdev->dev, "at least one ICB is required."); 421 dev_err(&pdev->dev, "at least one ICB is required.");
422 return -EINVAL;
423 }
424
425 mutex_lock(&priv->lock);
426
427 if (priv->used_meram_cache_regions + 2 > SH_MOBILE_MERAM_ICB_NUM) {
428 dev_err(&pdev->dev, "no more ICB available.");
431 error = -EINVAL; 429 error = -EINVAL;
432 goto err; 430 goto err;
433 } 431 }