Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 228529
b: refs/heads/master
c: f175b74
h: refs/heads/master
i:
  228527: 9d8ceab
v: v3
  • Loading branch information
Francisco Jerez authored and Ben Skeggs committed Dec 3, 2010
1 parent 38afece commit 236ecb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3945e47543863385b54d94c94b023ee7ca9df972
refs/heads/master: f175b745b50c5c5356e8b3b409b7f38aa44de6bb
5 changes: 2 additions & 3 deletions trunk/drivers/gpu/drm/nouveau/nouveau_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,16 @@ nouveau_channel_get(struct drm_device *dev, struct drm_file *file_priv, int id)
spin_lock_irqsave(&dev_priv->channels.lock, flags);
chan = dev_priv->channels.ptr[id];

if (unlikely(!chan || atomic_read(&chan->refcount) == 0)) {
if (unlikely(!chan || (file_priv && chan->file_priv != file_priv))) {
spin_unlock_irqrestore(&dev_priv->channels.lock, flags);
return ERR_PTR(-EINVAL);
}

if (unlikely(file_priv && chan->file_priv != file_priv)) {
if (unlikely(!atomic_inc_not_zero(&chan->refcount))) {
spin_unlock_irqrestore(&dev_priv->channels.lock, flags);
return ERR_PTR(-EINVAL);
}

atomic_inc(&chan->refcount);
spin_unlock_irqrestore(&dev_priv->channels.lock, flags);

mutex_lock(&chan->mutex);
Expand Down

0 comments on commit 236ecb3

Please sign in to comment.