From: Mario Limonciello <mario.limoncie...@amd.com> screen_info_pci_dev() relies upon resources being set up for devices before walking and thus isn't a good candidate for video_is_primary_device() when called as part of PCI device initialization.
The device argument passed to video_is_primary_device() already has the necessary information. Check that directly instead. Suggested-by: Bjorn Helgaas <bhelg...@google.com> Signed-off-by: Mario Limonciello <mario.limoncie...@amd.com> --- arch/x86/video/video-common.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/x86/video/video-common.c b/arch/x86/video/video-common.c index 4bbfffec4b640..e0aeee99bc99e 100644 --- a/arch/x86/video/video-common.c +++ b/arch/x86/video/video-common.c @@ -30,6 +30,8 @@ bool video_is_primary_device(struct device *dev) { #ifdef CONFIG_SCREEN_INFO struct screen_info *si = &screen_info; + struct resource res[SCREEN_INFO_MAX_RESOURCES]; + ssize_t i, numres; #endif struct pci_dev *pdev; @@ -45,8 +47,14 @@ bool video_is_primary_device(struct device *dev) return true; #ifdef CONFIG_SCREEN_INFO - if (pdev == screen_info_pci_dev(si)) - return true; + numres = screen_info_resources(si, res, ARRAY_SIZE(res)); + for (i = 0; i < numres; ++i) { + if (!(res[i].flags & IORESOURCE_MEM)) + continue; + + if (pci_find_resource(pdev, &res[i])) + return true; + } #endif return false; -- 2.48.1