Report if getresources call fails
authorThomas White <taw@bitwiz.org.uk>
Tue, 4 Aug 2009 21:48:50 +0000 (22:48 +0100)
committerThomas White <taw@bitwiz.org.uk>
Tue, 4 Aug 2009 21:48:50 +0000 (22:48 +0100)
This occurs if the test program does not have DRM master status, e.g. if
an X server is running.

gdrm-kms-addfb.c

index 4395230..4afda1e 100644 (file)
@@ -111,6 +111,10 @@ int main(int argc, char **argv)
        printf("Virtual address is 0x%p\n", addr);
 
        r = drmModeGetResources(fd);
+       if ( r == NULL ) {
+               printf("Could not get DRM resources\n");
+               return 1;
+       }
        printf("There are %i CRTCs, %i connectors, %i encoders"
               " and %i framebuffers\n",
               r->count_crtcs, r->count_connectors, r->count_encoders,