From patchwork Sat Jan 18 10:38:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soci/Singular X-Patchwork-Id: 13944112 Received: from c64.rulez.org (c64.rulez.org [79.139.58.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C279112EBEA for ; Sat, 18 Jan 2025 10:38:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.139.58.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737196741; cv=none; b=dhXwHZLMdhzTImM+NptIkiBJwa/UrgGgR48AZFDrJR3oLgwZJFte/K/TVsEOxvb9VuN7HkPv3um+nFQUniUCaVkFngF7MoUymtpVzWkQA3Xo1jSzon5XRkndHk7rUqj6GF/og+qerCbBdhgsG/dIOOGZ1+Hxno3OEn5LApzeggE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737196741; c=relaxed/simple; bh=sl471YsoOIbwV+NjW6c/AQ//0BNsaWSRjwK8/6ZZWaA=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=j4UTxKGnAGIE7VOe4uHyNaAwaisBOdwmM6qGEwnUPxRCjaTbYAhOvKkKT7bHFp0MI2SGDbR5LxrY1zAePcPCTecDsL7nl5IZDOx2PXPUOwGEqeNKHhn/42QthaxniCrqXDMNd5L47AZ5z7t67dIKv1SCYs8YuvhbiIEtgR361CA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=singularcrew.hu; spf=pass smtp.mailfrom=singularcrew.hu; dkim=pass (2048-bit key) header.d=singularcrew.hu header.i=@singularcrew.hu header.b=Ge7ilcVd; arc=none smtp.client-ip=79.139.58.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=singularcrew.hu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=singularcrew.hu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=singularcrew.hu header.i=@singularcrew.hu header.b="Ge7ilcVd" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=singularcrew.hu; s=mail; t=1737196736; bh=sl471YsoOIbwV+NjW6c/AQ//0BNsaWSRjwK8/6ZZWaA=; h=Date:To:From:Subject:From; b=Ge7ilcVdVqamt4L0qRSc+rhYQwyXZgkl4c9smito4xLceiBafcqyKr8sboCsZPQEM +pI5GytaKThnQfz75qqpYy39vPfP0F/d1wnjZpOL8FvuS4iX8okbzUoNlC2Qq7LNjE x6zrK5O40GvSujZLvZFhlDYiis0QVnfzFafIxWFOJEQ7rTyTsbYBfI9VfUZS0AIW2b +EajdlVD2Xt3lPvM6X51T51DjQ14PsTFbp8DvoD5Je8O2c6Qa/OUI/VyqLBBdv1clF O9XwhvFFBP9MceDE3i9gpDakeAIsqjW6f3gYoJc0XqQwqlNJnD4XcK8YDEC1Kru1xf c7xLINXtTkxCg== Date: Sat, 18 Jan 2025 11:38:56 +0100 Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Language: en-GB To: linux-fbdev@vger.kernel.org From: Soci/Singular Subject: [PATCH] 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 --- drivers/video/fbdev/vga16fb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c index fce0f5db7..eedab14c7 100644 --- a/drivers/video/fbdev/vga16fb.c +++ b/drivers/video/fbdev/vga16fb.c @@ -185,9 +185,10 @@ static inline void setindex(int index) /* Check if the video mode is supported by the driver */ static inline int check_mode_supported(const struct screen_info *si) { + unsigned int type = screen_info_video_type(si); + /* only EGA and VGA in 16 color graphic mode are supported */ - if (si->orig_video_isVGA != VIDEO_TYPE_EGAC && - si->orig_video_isVGA != VIDEO_TYPE_VGAC) + if (type != VIDEO_TYPE_EGAC && type != VIDEO_TYPE_VGAC) return -ENODEV; if (si->orig_video_mode != 0x0D && /* 320x200/4 (EGA) */ @@ -1338,7 +1339,7 @@ static int vga16fb_probe(struct platform_device *dev) printk(KERN_INFO "vga16fb: mapped to 0x%p\n", info->screen_base); par = info->par; - par->isVGA = si->orig_video_isVGA == VIDEO_TYPE_VGAC; + par->isVGA = screen_info_video_type(si) == VIDEO_TYPE_VGAC; par->palette_blanked = 0; par->vesa_blanked = 0;