drm/radeon: avoid crash if VM command submission isn't available
authorChristian König <christian.koenig@amd.com>
Wed, 21 May 2014 15:43:59 +0000 (17:43 +0200)
committerChristian König <christian.koenig@amd.com>
Fri, 30 May 2014 12:21:44 +0000 (14:21 +0200)
Signed-off-by: Christian König <christian.koenig@amd.com>
CC: stable@vger.kernel.org
drivers/gpu/drm/radeon/radeon_cs.c

index 2b6e0ebcc13ab5e75b76089dcbcc00eeae08b360..4b6f5b82415309cbdd427fafe5d683e43ecc63ce 100644 (file)
@@ -342,10 +342,17 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
                        return -EINVAL;
 
                /* we only support VM on some SI+ rings */
-               if ((p->rdev->asic->ring[p->ring]->cs_parse == NULL) &&
-                  ((p->cs_flags & RADEON_CS_USE_VM) == 0)) {
-                       DRM_ERROR("Ring %d requires VM!\n", p->ring);
-                       return -EINVAL;
+               if ((p->cs_flags & RADEON_CS_USE_VM) == 0) {
+                       if (p->rdev->asic->ring[p->ring]->cs_parse == NULL) {
+                               DRM_ERROR("Ring %d requires VM!\n", p->ring);
+                               return -EINVAL;
+                       }
+               } else {
+                       if (p->rdev->asic->ring[p->ring]->ib_parse == NULL) {
+                               DRM_ERROR("VM not supported on ring %d!\n",
+                                         p->ring);
+                               return -EINVAL;
+                       }
                }
        }