summaryrefslogtreecommitdiff
path: root/linux-core/nv50_dac.c
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2008-06-22 18:47:51 +0200
committerMaarten Maathuis <madman2003@gmail.com>2008-06-22 18:47:51 +0200
commite67cd7dda9d7d6d82f4026f246d07bf4c4021a57 (patch)
tree27d0cfeaee52daa79ac6d077420f074a29031d2d /linux-core/nv50_dac.c
parent3809209349ccf12aa71c7848f0b21d77fa0a5f03 (diff)
NV50: A few minor added safeties + cleanup.
Diffstat (limited to 'linux-core/nv50_dac.c')
-rw-r--r--linux-core/nv50_dac.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/linux-core/nv50_dac.c b/linux-core/nv50_dac.c
index f827fed4..b237241e 100644
--- a/linux-core/nv50_dac.c
+++ b/linux-core/nv50_dac.c
@@ -122,6 +122,7 @@ int nv50_dac_create(struct drm_device *dev, int dcb_entry)
struct nv50_output *output = NULL;
struct nv50_display *display = NULL;
struct dcb_entry *entry = NULL;
+ int rval = 0;
NV50_DEBUG("\n");
@@ -135,12 +136,16 @@ int nv50_dac_create(struct drm_device *dev, int dcb_entry)
output->dev = dev;
display = nv50_get_display(dev);
- if (!display)
+ if (!display) {
+ rval = -EINVAL;
goto out;
+ }
entry = &dev_priv->dcb_table.entry[dcb_entry];
- if (!entry)
+ if (!entry) {
+ rval = -EINVAL;
goto out;
+ }
switch (entry->type) {
case DCB_OUTPUT_ANALOG:
@@ -148,6 +153,7 @@ int nv50_dac_create(struct drm_device *dev, int dcb_entry)
DRM_INFO("Detected a DAC output\n");
break;
default:
+ rval = -EINVAL;
goto out;
}
@@ -157,6 +163,10 @@ int nv50_dac_create(struct drm_device *dev, int dcb_entry)
list_add_tail(&output->head, &display->outputs);
output->native_mode = kzalloc(sizeof(struct nouveau_hw_mode), GFP_KERNEL);
+ if (!output->native_mode) {
+ rval = -ENOMEM;
+ goto out;
+ }
/* Set function pointers. */
output->validate_mode = nv50_dac_validate_mode;
@@ -172,6 +182,6 @@ out:
kfree(output->native_mode);
if (dev_priv->free_output)
dev_priv->free_output(output);
- return -EINVAL;
+ return rval;
}