From 3a551c127439b2d5cad5c7ca817feab1ca4c78c5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 26 Sep 2011 15:54:13 +0100 Subject: drm/test: handle usub being empty fixes a segfault on make check seen in tinderbox --- tests/drmtest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/drmtest.c') 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) -- cgit v1.2.3