diff options
author | Maarten Maathuis <madman2003@gmail.com> | 2008-06-22 18:47:51 +0200 |
---|---|---|
committer | Maarten Maathuis <madman2003@gmail.com> | 2008-06-22 18:47:51 +0200 |
commit | e67cd7dda9d7d6d82f4026f246d07bf4c4021a57 (patch) | |
tree | 27d0cfeaee52daa79ac6d077420f074a29031d2d /linux-core/nv50_crtc.c | |
parent | 3809209349ccf12aa71c7848f0b21d77fa0a5f03 (diff) |
NV50: A few minor added safeties + cleanup.
Diffstat (limited to 'linux-core/nv50_crtc.c')
-rw-r--r-- | linux-core/nv50_crtc.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/linux-core/nv50_crtc.c b/linux-core/nv50_crtc.c index 974f5202..f34e7279 100644 --- a/linux-core/nv50_crtc.c +++ b/linux-core/nv50_crtc.c @@ -463,6 +463,7 @@ int nv50_crtc_create(struct drm_device *dev, int index) struct drm_nouveau_private *dev_priv = dev->dev_private; struct nv50_crtc *crtc = NULL; struct nv50_display *display = NULL; + int rval = 0; NV50_DEBUG("\n"); @@ -476,8 +477,10 @@ int nv50_crtc_create(struct drm_device *dev, int index) crtc->dev = dev; display = nv50_get_display(dev); - if (!display) + if (!display) { + rval = -EINVAL; goto out; + } list_add_tail(&crtc->head, &display->crtcs); @@ -486,6 +489,11 @@ int nv50_crtc_create(struct drm_device *dev, int index) crtc->mode = kzalloc(sizeof(struct nouveau_hw_mode), GFP_KERNEL); crtc->native_mode = kzalloc(sizeof(struct nouveau_hw_mode), GFP_KERNEL); + if (!crtc->mode || crtc->native_mode) { + rval = -ENOMEM; + goto out; + } + nv50_fb_create(crtc); nv50_lut_create(crtc); nv50_cursor_create(crtc); @@ -511,5 +519,5 @@ out: if (dev_priv->free_crtc) dev_priv->free_crtc(crtc); - return -EINVAL; + return rval; } |