diff -up linux-2.6.29.noarch/drivers/gpu/drm/radeon/radeon_cs.c.dma linux-2.6.29.noarch/drivers/gpu/drm/radeon/radeon_cs.c --- linux-2.6.29.noarch/drivers/gpu/drm/radeon/radeon_cs.c.dma 2009-06-18 09:36:58.000000000 +1000 +++ linux-2.6.29.noarch/drivers/gpu/drm/radeon/radeon_cs.c 2009-06-18 09:39:11.000000000 +1000 @@ -41,22 +41,27 @@ int radeon_cs_ioctl(struct drm_device *d long size; int r, i; + if (dev_priv == NULL) { + DRM_ERROR("called with no initialization\n"); + return -EINVAL; + } + + if (!drm_core_check_feature(dev, DRIVER_MODESET)) { + DRM_ERROR("CS ioctl called without modesetting\n"); + return -EINVAL; + } + mutex_lock(&dev_priv->cs.cs_mutex); /* set command stream id to 0 which is fake id */ cs_id = 0; cs->cs_id = cs_id; - if (dev_priv == NULL) { - DRM_ERROR("called with no initialization\n"); - mutex_unlock(&dev_priv->cs.cs_mutex); - return -EINVAL; - } + if (!cs->num_chunks) { mutex_unlock(&dev_priv->cs.cs_mutex); return 0; } - chunk_array = drm_calloc(cs->num_chunks, sizeof(uint64_t), DRM_MEM_DRIVER); if (!chunk_array) { mutex_unlock(&dev_priv->cs.cs_mutex);