summaryrefslogtreecommitdiff
path: root/linux/drm_fops.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drm_fops.h')
-rw-r--r--linux/drm_fops.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/linux/drm_fops.h b/linux/drm_fops.h
index d21f7898..4589231f 100644
--- a/linux/drm_fops.h
+++ b/linux/drm_fops.h
@@ -54,6 +54,7 @@ int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
{
int minor = iminor(inode);
drm_file_t *priv;
+ int ret;
if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */
if (!DRM(cpu_valid)()) return -EINVAL;
@@ -74,7 +75,11 @@ int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
priv->lock_count = 0;
if (dev->fn_tbl.open_helper)
- dev->fn_tbl.open_helper(dev, priv);
+ {
+ ret=dev->fn_tbl.open_helper(dev, priv);
+ if (ret < 0)
+ goto out_free;
+ }
down(&dev->struct_sem);
if (!dev->file_last) {
@@ -106,6 +111,9 @@ int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
#endif
return 0;
+ out_free:
+ DRM(free)(priv, sizeof(*priv), DRM_MEM_FILES);
+ return ret;
}
/** No-op. */