summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-09-26 15:54:13 +0100
committerDave Airlie <airlied@redhat.com>2011-09-26 15:54:13 +0100
commit3a551c127439b2d5cad5c7ca817feab1ca4c78c5 (patch)
treef86e1e7f6a70ff1f0994d47684d4f97983015024 /tests
parentcfee5218b17a2741e5519ed44091171e01f0dbb2 (diff)
drm/test: handle usub being empty
fixes a segfault on make check seen in tinderbox
Diffstat (limited to 'tests')
-rw-r--r--tests/drmtest.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/drmtest.c b/tests/drmtest.c
index 685a6527..a685102d 100644
--- a/tests/drmtest.c
+++ b/tests/drmtest.c
@@ -62,6 +62,7 @@ int drm_open_matching(const char *pci_glob, int flags)
struct udev_device *device, *parent;
struct udev_list_entry *entry;
const char *pci_id, *path;
+ const char *usub;
int fd;
udev = udev_new();
@@ -78,8 +79,9 @@ int drm_open_matching(const char *pci_glob, int flags)
path = udev_list_entry_get_name(entry);
device = udev_device_new_from_syspath(udev, path);
parent = udev_device_get_parent(device);
+ usub = udev_device_get_subsystem(parent);
/* Filter out KMS output devices. */
- if (strcmp(udev_device_get_subsystem(parent), "pci") != 0)
+ if (!usub || (strcmp(usub, "pci") != 0))
continue;
pci_id = udev_device_get_property_value(parent, "PCI_ID");
if (fnmatch(pci_glob, pci_id, 0) != 0)