fbdev/hyperv_fb: Fix logic error for Gen2 VMs in hvfb_getmem()
authorMichael Kelley <mhklinux@outlook.com>
Thu, 1 Feb 2024 06:00:22 +0000 (22:00 -0800)
committerWei Liu <wei.liu@kernel.org>
Fri, 1 Mar 2024 08:19:11 +0000 (08:19 +0000)
A recent commit removing the use of screen_info introduced a logic
error. The error causes hvfb_getmem() to always return -ENOMEM
for Generation 2 VMs. As a result, the Hyper-V frame buffer
device fails to initialize. The error was introduced by removing
an "else if" clause, leaving Gen2 VMs to always take the -ENOMEM
error path.

Fix the problem by removing the error path "else" clause. Gen 2
VMs now always proceed through the MMIO memory allocation code,
but with "base" and "size" defaulting to 0.

Fixes: 0aa0838c84da ("fbdev/hyperv_fb: Remove firmware framebuffers with aperture helpers")
Signed-off-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Link: https://lore.kernel.org/r/20240201060022.233666-1-mhklinux@outlook.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20240201060022.233666-1-mhklinux@outlook.com>

drivers/video/fbdev/hyperv_fb.c

index c26ee6fd73c9bb0cff77793e2af4ca5407c59aa1..8fdccf033b2d9bf9a05e967fb166bbabe82bfe19 100644 (file)
@@ -1010,8 +1010,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
                        goto getmem_done;
                }
                pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n");
-       } else {
-               goto err1;
        }
 
        /*