aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbmem.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2009-09-22 19:47:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:56 -0400
commit0fcf6ada2b8eb42d132c0846384f1299889609e3 (patch)
treeb6b9e2996eb621d6ab03d1d8ac5e00ce070cea76 /drivers/video/fbmem.c
parent360fa58828784f307c3977d5ff4c8e400f074a56 (diff)
fb: do not ignore fb_set_par errors
At the moment about half of the framebuffer drivers can return an error code in fb_set_par. Until now it would be silently ignored by fbmem.c and fbcon.c. This patch fixes fbmem.c to return the error code and restore var on error. But it is not clear in which video mode the device is when fb_set_par fails. It would be good and reasonable if it were in the old state but there is no guarantee that this is true for all existing drivers. Additionally print a message if a failing fb_set_par is detected in fbmem.c or fbcon.c. Although most errors should be caught by the previous fb_check_var some errors can't as they are dynamic (memory allocations, ...) and can only be detected while performing the operations which is forbidden in fb_check_var. This patch shouldn't have a negative impact on normal operation as all drivers return 0 on success. The impact in case of error depends heavily on the driver and caller but it's expected to be better than before. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/fbmem.c')
-rw-r--r--drivers/video/fbmem.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 346f257215a7..a1f2e7ce730b 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -954,6 +954,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
954 goto done; 954 goto done;
955 955
956 if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { 956 if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
957 struct fb_var_screeninfo old_var;
957 struct fb_videomode mode; 958 struct fb_videomode mode;
958 959
959 if (info->fbops->fb_get_caps) { 960 if (info->fbops->fb_get_caps) {
@@ -963,10 +964,20 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
963 goto done; 964 goto done;
964 } 965 }
965 966
967 old_var = info->var;
966 info->var = *var; 968 info->var = *var;
967 969
968 if (info->fbops->fb_set_par) 970 if (info->fbops->fb_set_par) {
969 info->fbops->fb_set_par(info); 971 ret = info->fbops->fb_set_par(info);
972
973 if (ret) {
974 info->var = old_var;
975 printk(KERN_WARNING "detected "
976 "fb_set_par error, "
977 "error code: %d\n", ret);
978 goto done;
979 }
980 }
970 981
971 fb_pan_display(info, &info->var); 982 fb_pan_display(info, &info->var);
972 fb_set_cmap(&info->cmap, info); 983 fb_set_cmap(&info->cmap, info);