From 0be01624315368ccf8659fa0d99edf54379e60f6 Mon Sep 17 00:00:00 2001 From: Kazutaka YOKOTA Date: Tue, 7 Dec 1999 11:23:58 +0000 Subject: Fix the ioctl CONS_FINDMODE and its underlying subroutine xxx_query_mode() in the vga and vesa drivers. - xxx_query_mode() returns 0 (success) and a positive error number. - Copy mode information on success. - Remove redundant structure copy. The bug first found in -STABLE by jmg. --- sys/dev/fb/fb.c | 8 -------- sys/dev/fb/vga.c | 9 ++++----- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 59ac170a88b91..b95003eb2651e 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -754,14 +754,6 @@ fb_commonioctl(video_adapter_t *adp, u_long cmd, caddr_t arg) case FBIO_FINDMODE: /* find a matching video mode */ error = (*vidsw[adp->va_index]->query_mode)(adp, (video_info_t *)arg); - if (error < 0) { - error = EINVAL; - } else { - error = (*vidsw[adp->va_index]->get_info)(adp, - error, (video_info_t *)arg); - if (error) - error = ENODEV; /* shouldn't happen */ - } break; case FBIO_GETMODE: /* get video mode */ diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 6c96dae439a75..f733e4745fbab 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -1441,11 +1441,10 @@ vga_get_info(video_adapter_t *adp, int mode, video_info_t *info) static int vga_query_mode(video_adapter_t *adp, video_info_t *info) { - video_info_t buf; int i; if (!vga_init_done) - return -1; + return ENXIO; for (i = 0; bios_vmode[i].vi_mode != EOT; ++i) { if (bios_vmode[i].vi_mode == NA) @@ -1475,11 +1474,11 @@ vga_query_mode(video_adapter_t *adp, video_info_t *info) continue; /* verify if this mode is supported on this adapter */ - if (vga_get_info(adp, bios_vmode[i].vi_mode, &buf)) + if (vga_get_info(adp, bios_vmode[i].vi_mode, info)) continue; - return bios_vmode[i].vi_mode; + return 0; } - return -1; + return ENODEV; } /* -- cgit v1.3