diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2007-05-08 03:39:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:33 -0400 |
commit | b1e7223f28b4ed5073d2029a3597bf514ff514f2 (patch) | |
tree | d3b41f37e9aa57e4dc400333e9ee3f25afd9018c /drivers/video/fbmem.c | |
parent | 0959f0ca29244ae983b406fba313816a29244be7 (diff) |
fbdev: clean up exit patch of fb_set_var
Clean up exit patch of fb_set_var():
- consolidate all return values into a single local variable
- ensure that return values are valid error codes
- fix fb_set_var() returning success when fb_check_caps() failed
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
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.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 354711c84aaa..08d4e11d9121 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -799,11 +799,11 @@ static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, | |||
799 | int | 799 | int |
800 | fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | 800 | fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) |
801 | { | 801 | { |
802 | int err, flags = info->flags; | 802 | int flags = info->flags; |
803 | int ret = 0; | ||
803 | 804 | ||
804 | if (var->activate & FB_ACTIVATE_INV_MODE) { | 805 | if (var->activate & FB_ACTIVATE_INV_MODE) { |
805 | struct fb_videomode mode1, mode2; | 806 | struct fb_videomode mode1, mode2; |
806 | int ret = 0; | ||
807 | 807 | ||
808 | fb_var_to_videomode(&mode1, var); | 808 | fb_var_to_videomode(&mode1, var); |
809 | fb_var_to_videomode(&mode2, &info->var); | 809 | fb_var_to_videomode(&mode2, &info->var); |
@@ -821,7 +821,9 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | |||
821 | if (!ret) | 821 | if (!ret) |
822 | fb_delete_videomode(&mode1, &info->modelist); | 822 | fb_delete_videomode(&mode1, &info->modelist); |
823 | 823 | ||
824 | return ret; | 824 | |
825 | ret = (ret) ? -EINVAL : 0; | ||
826 | goto done; | ||
825 | } | 827 | } |
826 | 828 | ||
827 | if ((var->activate & FB_ACTIVATE_FORCE) || | 829 | if ((var->activate & FB_ACTIVATE_FORCE) || |
@@ -830,20 +832,21 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | |||
830 | 832 | ||
831 | if (!info->fbops->fb_check_var) { | 833 | if (!info->fbops->fb_check_var) { |
832 | *var = info->var; | 834 | *var = info->var; |
833 | return 0; | 835 | goto done; |
834 | } | 836 | } |
835 | 837 | ||
836 | if ((err = info->fbops->fb_check_var(var, info))) | 838 | ret = info->fbops->fb_check_var(var, info); |
837 | return err; | 839 | |
840 | if (ret) | ||
841 | goto done; | ||
838 | 842 | ||
839 | if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { | 843 | if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { |
840 | struct fb_videomode mode; | 844 | struct fb_videomode mode; |
841 | int err = 0; | ||
842 | 845 | ||
843 | if (info->fbops->fb_get_caps) { | 846 | if (info->fbops->fb_get_caps) { |
844 | err = fb_check_caps(info, var, activate); | 847 | ret = fb_check_caps(info, var, activate); |
845 | 848 | ||
846 | if (err) | 849 | if (ret) |
847 | goto done; | 850 | goto done; |
848 | } | 851 | } |
849 | 852 | ||
@@ -853,16 +856,14 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | |||
853 | info->fbops->fb_set_par(info); | 856 | info->fbops->fb_set_par(info); |
854 | 857 | ||
855 | fb_pan_display(info, &info->var); | 858 | fb_pan_display(info, &info->var); |
856 | |||
857 | fb_set_cmap(&info->cmap, info); | 859 | fb_set_cmap(&info->cmap, info); |
858 | |||
859 | fb_var_to_videomode(&mode, &info->var); | 860 | fb_var_to_videomode(&mode, &info->var); |
860 | 861 | ||
861 | if (info->modelist.prev && info->modelist.next && | 862 | if (info->modelist.prev && info->modelist.next && |
862 | !list_empty(&info->modelist)) | 863 | !list_empty(&info->modelist)) |
863 | err = fb_add_videomode(&mode, &info->modelist); | 864 | ret = fb_add_videomode(&mode, &info->modelist); |
864 | 865 | ||
865 | if (!err && (flags & FBINFO_MISC_USEREVENT)) { | 866 | if (!ret && (flags & FBINFO_MISC_USEREVENT)) { |
866 | struct fb_event event; | 867 | struct fb_event event; |
867 | int evnt = (activate & FB_ACTIVATE_ALL) ? | 868 | int evnt = (activate & FB_ACTIVATE_ALL) ? |
868 | FB_EVENT_MODE_CHANGE_ALL : | 869 | FB_EVENT_MODE_CHANGE_ALL : |
@@ -876,7 +877,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | |||
876 | } | 877 | } |
877 | 878 | ||
878 | done: | 879 | done: |
879 | return 0; | 880 | return ret; |
880 | } | 881 | } |
881 | 882 | ||
882 | int | 883 | int |