Skip to content

Commit c542a56

Browse files
soci64hdeller
authored andcommitted
fbdev: vga16fb: fix orig_video_isVGA confusion
At some point the orig_video_isVGA field of screen_info was repurposed for video type. Using it directly for video type check is unsafe as it can still mean yes (1) or no-output (0) in certain configurations. I had one of those. Signed-off-by: Zsolt Kajtar <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 3a48b38 commit c542a56

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/video/fbdev/vga16fb.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,10 @@ static inline void setindex(int index)
185185
/* Check if the video mode is supported by the driver */
186186
static inline int check_mode_supported(const struct screen_info *si)
187187
{
188+
unsigned int type = screen_info_video_type(si);
189+
188190
/* only EGA and VGA in 16 color graphic mode are supported */
189-
if (si->orig_video_isVGA != VIDEO_TYPE_EGAC &&
190-
si->orig_video_isVGA != VIDEO_TYPE_VGAC)
191+
if (type != VIDEO_TYPE_EGAC && type != VIDEO_TYPE_VGAC)
191192
return -ENODEV;
192193

193194
if (si->orig_video_mode != 0x0D && /* 320x200/4 (EGA) */
@@ -1338,7 +1339,7 @@ static int vga16fb_probe(struct platform_device *dev)
13381339
printk(KERN_INFO "vga16fb: mapped to 0x%p\n", info->screen_base);
13391340
par = info->par;
13401341

1341-
par->isVGA = si->orig_video_isVGA == VIDEO_TYPE_VGAC;
1342+
par->isVGA = screen_info_video_type(si) == VIDEO_TYPE_VGAC;
13421343
par->palette_blanked = 0;
13431344
par->vesa_blanked = 0;
13441345

0 commit comments

Comments
 (0)