radeon: fail properly if we can't create the ring.

Normally this will be due to an AGP driver needing updating
main
Dave Airlie 2008-09-18 10:19:08 +10:00
parent 515aa0800c
commit 8f38c28a39
2 changed files with 18 additions and 5 deletions

View File

@ -667,7 +667,10 @@ int radeon_alloc_gart_objects(struct drm_device *dev)
DRM_BO_FLAG_MAPPABLE | DRM_BO_FLAG_NO_EVICT,
0, 1, 0, &dev_priv->mm.ring.bo);
if (ret) {
DRM_ERROR("failed to allocate ring\n");
if (dev_priv->flags & RADEON_IS_AGP)
DRM_ERROR("failed to allocate ring - most likely an AGP driver bug\n");
else
DRM_ERROR("failed to allocate ring\n");
return -EINVAL;
}
@ -1004,8 +1007,10 @@ int radeon_gem_mm_init(struct drm_device *dev)
/* need to allocate some objects in the GART */
/* ring + ring read ptr */
ret = radeon_alloc_gart_objects(dev);
if (ret)
if (ret) {
radeon_gem_mm_fini(dev);
return -EINVAL;
}
dev_priv->mm_enabled = true;
return 0;
@ -1508,8 +1513,10 @@ static void radeon_gem_dma_bufs_destroy(struct drm_device *dev)
struct drm_radeon_private *dev_priv = dev->dev_private;
drm_dma_takedown(dev);
drm_bo_kunmap(&dev_priv->mm.dma_bufs.kmap);
drm_bo_usage_deref_unlocked(&dev_priv->mm.dma_bufs.bo);
if (dev_priv->mm.dma_bufs.bo) {
drm_bo_kunmap(&dev_priv->mm.dma_bufs.kmap);
drm_bo_usage_deref_unlocked(&dev_priv->mm.dma_bufs.bo);
}
}

View File

@ -2549,7 +2549,9 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
radeon_gem_mm_init(dev);
ret = radeon_gem_mm_init(dev);
if (ret)
goto modeset_fail;
radeon_modeset_init(dev);
radeon_modeset_cp_init(dev);
@ -2559,6 +2561,10 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
}
return ret;
modeset_fail:
dev->driver->driver_features &= ~DRIVER_MODESET;
drm_put_minor(&dev->control);
return ret;
}