aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sh_mobile_meram.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-07-13 12:13:47 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-08-19 08:22:43 +0200
commit7963e21e50c8e712553347f900f0d0afaf5be2aa (patch)
tree70dc22f019cfd44ca5a6983503f32a5ef5de1bf7 /drivers/video/sh_mobile_meram.c
parentfbdev: sh_mobile_meram: Replace hardcoded register values with macros (diff)
downloadlinux-dev-7963e21e50c8e712553347f900f0d0afaf5be2aa.tar.xz
linux-dev-7963e21e50c8e712553347f900f0d0afaf5be2aa.zip
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,
xres, yres, (!pixelformat) ? "yuv" : "rgb",
base_addr_y, base_addr_c);
- mutex_lock(&priv->lock);
-
/* we can't handle wider than 8192px */
if (xres > 8192) {
dev_err(&pdev->dev, "width exceeding the limit (> 8192).");
- error = -EINVAL;
- goto err;
- }
-
- if (priv->used_meram_cache_regions + 2 > SH_MOBILE_MERAM_ICB_NUM) {
- dev_err(&pdev->dev, "no more ICB available.");
- error = -EINVAL;
- goto err;
+ return -EINVAL;
}
/* do we have at least one ICB config? */
if (cfg->icb[0].marker_icb < 0 || cfg->icb[0].cache_icb < 0) {
dev_err(&pdev->dev, "at least one ICB is required.");
+ return -EINVAL;
+ }
+
+ mutex_lock(&priv->lock);
+
+ if (priv->used_meram_cache_regions + 2 > SH_MOBILE_MERAM_ICB_NUM) {
+ dev_err(&pdev->dev, "no more ICB available.");
error = -EINVAL;
goto err;
}