[Intel-gfx] [PATCH] drm/i915: fix modeset devname allocation + agp init return check.

Dave Airlie airlied at gmail.com
Mon Dec 29 07:31:13 CET 2008


From: Dave Airlie <airlied at redhat.com>

devname needs to be allocated before the irq is installed, so the
irq routines get the correct name in /proc.

Also check the return value from the AGP init function, and
fixup the exit points.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/i915/i915_dma.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 65482ca..3d7082a 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -907,6 +907,12 @@ static int i915_load_modeset_init(struct drm_device *dev)
 	int fb_bar = IS_I9XX(dev) ? 2 : 0;
 	int ret = 0;
 
+	dev->devname = kstrdup(DRIVER_NAME, GFP_KERNEL);
+	if (!dev->devname) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
 	dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) &
 		0xff000000;
 
@@ -917,7 +923,9 @@ static int i915_load_modeset_init(struct drm_device *dev)
 	else
 		dev_priv->cursor_needs_physical = false;
 
-	i915_probe_agp(dev, &agp_size, &prealloc_size);
+	ret = i915_probe_agp(dev, &agp_size, &prealloc_size);
+	if (ret)
+		goto kfree_devname;
 
 	/* Basic memrange allocator for stolen space (aka vram) */
 	drm_mm_init(&dev_priv->vram, 0, prealloc_size);
@@ -927,7 +935,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
 
 	ret = i915_gem_init_ringbuffer(dev);
 	if (ret)
-		goto out;
+		goto kfree_devname;
 
         dev_priv->mm.gtt_mapping =
 		io_mapping_create_wc(dev->agp->base,
@@ -966,18 +974,12 @@ static int i915_load_modeset_init(struct drm_device *dev)
 
 	drm_helper_initial_config(dev, false);
 
-	dev->devname = kstrdup(DRIVER_NAME, GFP_KERNEL);
-	if (!dev->devname) {
-		ret = -ENOMEM;
-		goto modeset_cleanup;
-	}
-
 	return 0;
 
-modeset_cleanup:
-	intel_modeset_cleanup(dev);
 destroy_ringbuffer:
 	i915_gem_cleanup_ringbuffer(dev);
+kfree_devname:
+	kfree(dev->devname);
 out:
 	return ret;
 }
-- 
1.6.0.1




More information about the Intel-gfx mailing list