|
@@ -585,10 +585,13 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
|
|
|
struct timeval now;
|
|
|
unsigned long flags;
|
|
|
unsigned int seq;
|
|
|
+ int ret;
|
|
|
|
|
|
e = kzalloc(sizeof *e, GFP_KERNEL);
|
|
|
- if (e == NULL)
|
|
|
- return -ENOMEM;
|
|
|
+ if (e == NULL) {
|
|
|
+ ret = -ENOMEM;
|
|
|
+ goto err_put;
|
|
|
+ }
|
|
|
|
|
|
e->pipe = pipe;
|
|
|
e->base.pid = current->pid;
|
|
@@ -603,9 +606,8 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
|
|
|
spin_lock_irqsave(&dev->event_lock, flags);
|
|
|
|
|
|
if (file_priv->event_space < sizeof e->event) {
|
|
|
- spin_unlock_irqrestore(&dev->event_lock, flags);
|
|
|
- kfree(e);
|
|
|
- return -ENOMEM;
|
|
|
+ ret = -EBUSY;
|
|
|
+ goto err_unlock;
|
|
|
}
|
|
|
|
|
|
file_priv->event_space -= sizeof e->event;
|
|
@@ -638,6 +640,13 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
|
|
|
spin_unlock_irqrestore(&dev->event_lock, flags);
|
|
|
|
|
|
return 0;
|
|
|
+
|
|
|
+err_unlock:
|
|
|
+ spin_unlock_irqrestore(&dev->event_lock, flags);
|
|
|
+ kfree(e);
|
|
|
+err_put:
|
|
|
+ drm_vblank_put(dev, e->pipe);
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
/**
|