From e67cd7dda9d7d6d82f4026f246d07bf4c4021a57 Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Sun, 22 Jun 2008 18:47:51 +0200 Subject: NV50: A few minor added safeties + cleanup. --- linux-core/nv50_crtc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'linux-core/nv50_crtc.c') 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; } -- cgit v1.2.3