diff options
author | Dave Airlie <airlied@linux.ie> | 2008-12-29 01:35:02 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2008-12-29 03:18:19 -0500 |
commit | aa5966296675a5092505f68d72563d5939a92353 (patch) | |
tree | 9653e7a7674a2cf668fe0e33ba789a6a45f84ca5 /drivers/gpu | |
parent | aad87dff5acb232666932e750318ec1fdb716e79 (diff) |
drm/i915: fix modeset devname allocation + agp init return check.
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@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | 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 65482cabc94a..3d7082af5b72 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) | |||
907 | int fb_bar = IS_I9XX(dev) ? 2 : 0; | 907 | int fb_bar = IS_I9XX(dev) ? 2 : 0; |
908 | int ret = 0; | 908 | int ret = 0; |
909 | 909 | ||
910 | dev->devname = kstrdup(DRIVER_NAME, GFP_KERNEL); | ||
911 | if (!dev->devname) { | ||
912 | ret = -ENOMEM; | ||
913 | goto out; | ||
914 | } | ||
915 | |||
910 | dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & | 916 | dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & |
911 | 0xff000000; | 917 | 0xff000000; |
912 | 918 | ||
@@ -917,7 +923,9 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
917 | else | 923 | else |
918 | dev_priv->cursor_needs_physical = false; | 924 | dev_priv->cursor_needs_physical = false; |
919 | 925 | ||
920 | i915_probe_agp(dev, &agp_size, &prealloc_size); | 926 | ret = i915_probe_agp(dev, &agp_size, &prealloc_size); |
927 | if (ret) | ||
928 | goto kfree_devname; | ||
921 | 929 | ||
922 | /* Basic memrange allocator for stolen space (aka vram) */ | 930 | /* Basic memrange allocator for stolen space (aka vram) */ |
923 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); | 931 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); |
@@ -927,7 +935,7 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
927 | 935 | ||
928 | ret = i915_gem_init_ringbuffer(dev); | 936 | ret = i915_gem_init_ringbuffer(dev); |
929 | if (ret) | 937 | if (ret) |
930 | goto out; | 938 | goto kfree_devname; |
931 | 939 | ||
932 | dev_priv->mm.gtt_mapping = | 940 | dev_priv->mm.gtt_mapping = |
933 | io_mapping_create_wc(dev->agp->base, | 941 | io_mapping_create_wc(dev->agp->base, |
@@ -966,18 +974,12 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
966 | 974 | ||
967 | drm_helper_initial_config(dev, false); | 975 | drm_helper_initial_config(dev, false); |
968 | 976 | ||
969 | dev->devname = kstrdup(DRIVER_NAME, GFP_KERNEL); | ||
970 | if (!dev->devname) { | ||
971 | ret = -ENOMEM; | ||
972 | goto modeset_cleanup; | ||
973 | } | ||
974 | |||
975 | return 0; | 977 | return 0; |
976 | 978 | ||
977 | modeset_cleanup: | ||
978 | intel_modeset_cleanup(dev); | ||
979 | destroy_ringbuffer: | 979 | destroy_ringbuffer: |
980 | i915_gem_cleanup_ringbuffer(dev); | 980 | i915_gem_cleanup_ringbuffer(dev); |
981 | kfree_devname: | ||
982 | kfree(dev->devname); | ||
981 | out: | 983 | out: |
982 | return ret; | 984 | return ret; |
983 | } | 985 | } |