[PATCH] Do nothing when there are no platform devices

Marcin Juszkiewicz mjuszkiewicz at redhat.com
Mon Aug 31 11:24:10 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=91820

I have APM Mustang (AArch64 (64-bit ARMv8) architecture) on my desk. As
it has x8 pcie slot I connected Radeon HD5450 graphics card to it. But
to get X11 running I need to have xorg.conf snippet with BusID set.

Digged into xserver source and found why it happens:

Configure sets CONFIG_UDEV_KMS variable and then XSERVER_PLATFORM_BUS is
set as well.

Then we have xf86BusProbe() function in hw/xfree86/common/xf86Bus.c
(xserver source file). If XSERVER_PLATFORM_BUS is defined then
xf86platformProbe() is called. And then it fails.

But if I disable that block then xf86PciProbe() is called and xserver
finds PCIe card properly.

So let's check why it fails in xf86platformProbe()...

xf86platformProbe() calls config_odev_probe(xf86PlatformDeviceProbe)
(argument is callback name)

xf86PlatformDeviceProbe() goes xf86_num_platform_devices times over
xf86_platform_odev_attributes table to find /dev/dri/card0 entry.

The problem is that xf86_num_platform_devices == 0 so there is nothing
to search for.

commit 28defe7722ff4aa09183e67c72e90767539465d2
Author: Marcin Juszkiewicz <mjuszkiewicz at redhat.com>
Date:   Mon Aug 31 20:18:11 2015 +0200

    Do nothing if there are no platform devices
    
    Signed-off-by: Marcin Juszkiewicz <mjuszkiewicz at redhat.com>

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 1d145b3..cdc7a89 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -151,6 +151,9 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
     if (!path)
         goto out_free;
 
+    if (!xf86_num_platform_devices)
+        goto out_free;
+
     for (i = 0; i < xf86_num_platform_devices; i++) {
         char *dpath = xf86_platform_odev_attributes(i)->path;
 


More information about the xorg-devel mailing list