aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-08-08 08:36:38 -0400
committerDave Airlie <airlied@redhat.com>2010-08-09 20:46:51 -0400
commitcce13ff7596985903ad924504562190a2c163a63 (patch)
treec60bf375aa1e59727979466ef69804211ac03db9 /drivers/gpu
parent0d18abedfadbf462c107b0b782142558896a8ace (diff)
drm: Propagate error code from fb_create()
Change the interface to expect a PTR_ERR specifing the real error code as opposed to assuming a NULL return => -EINVAL. Just once the user may not be at fault! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_crtc.c4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c6
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c7
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c8
6 files changed, 18 insertions, 17 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 4c68f76993d8..bdd0d903872a 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1682,9 +1682,9 @@ int drm_mode_addfb(struct drm_device *dev,
1682 /* TODO setup destructor callback */ 1682 /* TODO setup destructor callback */
1683 1683
1684 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); 1684 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r);
1685 if (!fb) { 1685 if (IS_ERR(fb)) {
1686 DRM_ERROR("could not create framebuffer\n"); 1686 DRM_ERROR("could not create framebuffer\n");
1687 ret = -EINVAL; 1687 ret = PTR_ERR(fb);
1688 goto out; 1688 goto out;
1689 } 1689 }
1690 1690
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ae1718549eec..ec8336a4b7de 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5312,18 +5312,18 @@ intel_user_framebuffer_create(struct drm_device *dev,
5312 5312
5313 obj = drm_gem_object_lookup(dev, filp, mode_cmd->handle); 5313 obj = drm_gem_object_lookup(dev, filp, mode_cmd->handle);
5314 if (!obj) 5314 if (!obj)
5315 return NULL; 5315 return ERR_PTR(-ENOENT);
5316 5316
5317 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); 5317 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
5318 if (!intel_fb) 5318 if (!intel_fb)
5319 return NULL; 5319 return ERR_PTR(-ENOMEM);
5320 5320
5321 ret = intel_framebuffer_init(dev, intel_fb, 5321 ret = intel_framebuffer_init(dev, intel_fb,
5322 mode_cmd, obj); 5322 mode_cmd, obj);
5323 if (ret) { 5323 if (ret) {
5324 drm_gem_object_unreference_unlocked(obj); 5324 drm_gem_object_unreference_unlocked(obj);
5325 kfree(intel_fb); 5325 kfree(intel_fb);
5326 return NULL; 5326 return ERR_PTR(ret);
5327 } 5327 }
5328 5328
5329 return &intel_fb->base; 5329 return &intel_fb->base;
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 3e18c9e7729b..1d2d67ce4a84 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -119,7 +119,9 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
119 119
120 info->par = ifbdev; 120 info->par = ifbdev;
121 121
122 intel_framebuffer_init(dev, &ifbdev->ifb, &mode_cmd, fbo); 122 ret = intel_framebuffer_init(dev, &ifbdev->ifb, &mode_cmd, fbo);
123 if (ret)
124 goto out_unpin;
123 125
124 fb = &ifbdev->ifb.base; 126 fb = &ifbdev->ifb.base;
125 127
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 74e6b4ed12c0..2e11fd65b4dd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -84,16 +84,16 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
84 84
85 gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle); 85 gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle);
86 if (!gem) 86 if (!gem)
87 return NULL; 87 return ERR_PTR(-ENOENT);
88 88
89 nouveau_fb = kzalloc(sizeof(struct nouveau_framebuffer), GFP_KERNEL); 89 nouveau_fb = kzalloc(sizeof(struct nouveau_framebuffer), GFP_KERNEL);
90 if (!nouveau_fb) 90 if (!nouveau_fb)
91 return NULL; 91 return ERR_PTR(-ENOMEM);
92 92
93 ret = nouveau_framebuffer_init(dev, nouveau_fb, mode_cmd, nouveau_gem_object(gem)); 93 ret = nouveau_framebuffer_init(dev, nouveau_fb, mode_cmd, nouveau_gem_object(gem));
94 if (ret) { 94 if (ret) {
95 drm_gem_object_unreference(gem); 95 drm_gem_object_unreference(gem);
96 return NULL; 96 return ERR_PTR(ret);
97 } 97 }
98 98
99 return &nouveau_fb->base; 99 return &nouveau_fb->base;
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index d49a14891f83..6130ec9ed502 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -888,13 +888,12 @@ radeon_user_framebuffer_create(struct drm_device *dev,
888 if (obj == NULL) { 888 if (obj == NULL) {
889 dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, " 889 dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, "
890 "can't create framebuffer\n", mode_cmd->handle); 890 "can't create framebuffer\n", mode_cmd->handle);
891 return NULL; 891 return ERR_PTR(-ENOENT);
892 } 892 }
893 893
894 radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL); 894 radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL);
895 if (radeon_fb == NULL) { 895 if (radeon_fb == NULL)
896 return NULL; 896 return ERR_PTR(-ENOMEM);
897 }
898 897
899 radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); 898 radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj);
900 899
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 437ac786277a..64d7f47df868 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -737,7 +737,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
737 737
738 if (ret) { 738 if (ret) {
739 DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); 739 DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret);
740 return NULL; 740 return ERR_PTR(ret);
741 } 741 }
742 return &vfb->base; 742 return &vfb->base;
743 743
@@ -747,7 +747,7 @@ try_dmabuf:
747 ret = vmw_user_dmabuf_lookup(tfile, mode_cmd->handle, &bo); 747 ret = vmw_user_dmabuf_lookup(tfile, mode_cmd->handle, &bo);
748 if (ret) { 748 if (ret) {
749 DRM_ERROR("failed to find buffer: %i\n", ret); 749 DRM_ERROR("failed to find buffer: %i\n", ret);
750 return NULL; 750 return ERR_PTR(-ENOENT);
751 } 751 }
752 752
753 ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb, 753 ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb,
@@ -758,7 +758,7 @@ try_dmabuf:
758 758
759 if (ret) { 759 if (ret) {
760 DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); 760 DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret);
761 return NULL; 761 return ERR_PTR(ret);
762 } 762 }
763 763
764 return &vfb->base; 764 return &vfb->base;
@@ -768,7 +768,7 @@ err_not_scanout:
768 /* vmw_user_surface_lookup takes one ref */ 768 /* vmw_user_surface_lookup takes one ref */
769 vmw_surface_unreference(&surface); 769 vmw_surface_unreference(&surface);
770 770
771 return NULL; 771 return ERR_PTR(-EINVAL);
772} 772}
773 773
774static struct drm_mode_config_funcs vmw_kms_funcs = { 774static struct drm_mode_config_funcs vmw_kms_funcs = {