# \[PATCH\] Do set var even if no fb\_check\_var() provided.

- From: Takashi Yoshii \<hidden\>
- Date: 2008-08-27 05:09:09 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2008/08/13458691
- Thread: https://ratatoskr.run/linux-fbdev/2008/08/13458691/t.md

```text
Hi,

The behavior of FBIOSET_VSCREENINFO seems to be weired on FB which does not
 provides fbops->fb_check_var.
It doesn't set anything, but gets info->var instead, and returns no error.
It is just same as FBIOGET_VSCREENINFO does.

IMHO, this should be one of the following candidates,
 1. set var without check.
 2. do nothing but return error (setting var is not supported).
or
 3. it's a bug (fb_check_var should always be provided).

The patch at the bottom implements "1".

Because I don't know API specification, nor the history of the code, 
I would like people who knows well to discuss this.

Regards,
/yoshii
---
drivers/video/fbmem.c:fb_set_var()
 Do set_var even if fbops->fb_check_var == NULL.
 Possible API change of ioctl(FBIOSET_VSCREENINFO).

Signed-off-by: Takashi YOSHII <redacted>

diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 776f7fc..6fc2ba6 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -939,16 +939,12 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 	    memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) {
 		u32 activate = var->activate;
 
-		if (!info->fbops->fb_check_var) {
-			*var = info->var;
-			goto done;
+		if (info->fbops->fb_check_var) {
+			ret = info->fbops->fb_check_var(var, info);
+			if (ret)
+				goto done;
 		}
 
-		ret = info->fbops->fb_check_var(var, info);
-
-		if (ret)
-			goto done;
-
 		if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
 			struct fb_videomode mode;
 
-- 
1.5.4.5


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
```
