]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
drm/nouveau: return error from nouveau_ramht_remove() if not found
authorBen Skeggs <bskeggs@redhat.com>
Tue, 12 Oct 2010 00:11:00 +0000 (10:11 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 3 Dec 2010 05:05:27 +0000 (15:05 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_object.c
drivers/gpu/drm/nouveau/nouveau_ramht.c
drivers/gpu/drm/nouveau/nouveau_ramht.h

index 068441c4b5632cd9f030481497e648e5a12ece5b..ce9958a30175389fcbafe3baee66f004a031c863 100644 (file)
@@ -926,20 +926,14 @@ int nouveau_ioctl_gpuobj_free(struct drm_device *dev, void *data,
                              struct drm_file *file_priv)
 {
        struct drm_nouveau_gpuobj_free *objfree = data;
-       struct nouveau_gpuobj *gpuobj;
        struct nouveau_channel *chan;
-       int ret = -ENOENT;
+       int ret;
 
        chan = nouveau_channel_get(dev, file_priv, objfree->channel);
        if (IS_ERR(chan))
                return PTR_ERR(chan);
 
-       gpuobj = nouveau_ramht_find(chan, objfree->handle);
-       if (gpuobj) {
-               nouveau_ramht_remove(chan, objfree->handle);
-               ret = 0;
-       }
-
+       ret = nouveau_ramht_remove(chan, objfree->handle);
        nouveau_channel_put(&chan);
        return ret;
 }
index 2d8580927ca4579075cd870e5cfdf6459c44d9c6..b4c63c0588885fc87306000133c614267471dffd 100644 (file)
@@ -214,18 +214,19 @@ out:
        spin_unlock_irqrestore(&chan->ramht->lock, flags);
 }
 
-void
+int
 nouveau_ramht_remove(struct nouveau_channel *chan, u32 handle)
 {
        struct nouveau_ramht_entry *entry;
 
        entry = nouveau_ramht_remove_entry(chan, handle);
        if (!entry)
-               return;
+               return -ENOENT;
 
        nouveau_ramht_remove_hash(chan, entry->handle);
        nouveau_gpuobj_ref(NULL, &entry->gpuobj);
        kfree(entry);
+       return 0;
 }
 
 struct nouveau_gpuobj *
index b79cb5e1a8f1cc8f4404eeea4e37fb4fe0e19d7e..c82de98fee0eaae987bbfb8793a582d01335cf99 100644 (file)
@@ -48,7 +48,7 @@ extern void nouveau_ramht_ref(struct nouveau_ramht *, struct nouveau_ramht **,
 
 extern int  nouveau_ramht_insert(struct nouveau_channel *, u32 handle,
                                 struct nouveau_gpuobj *);
-extern void nouveau_ramht_remove(struct nouveau_channel *, u32 handle);
+extern int  nouveau_ramht_remove(struct nouveau_channel *, u32 handle);
 extern struct nouveau_gpuobj *
 nouveau_ramht_find(struct nouveau_channel *chan, u32 handle);