forked from Minki/linux
drm/nouveau: return error from nouveau_ramht_remove() if not found
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
938c40ed69
commit
18a16a768c
@ -926,20 +926,14 @@ int nouveau_ioctl_gpuobj_free(struct drm_device *dev, void *data,
|
|||||||
struct drm_file *file_priv)
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
struct drm_nouveau_gpuobj_free *objfree = data;
|
struct drm_nouveau_gpuobj_free *objfree = data;
|
||||||
struct nouveau_gpuobj *gpuobj;
|
|
||||||
struct nouveau_channel *chan;
|
struct nouveau_channel *chan;
|
||||||
int ret = -ENOENT;
|
int ret;
|
||||||
|
|
||||||
chan = nouveau_channel_get(dev, file_priv, objfree->channel);
|
chan = nouveau_channel_get(dev, file_priv, objfree->channel);
|
||||||
if (IS_ERR(chan))
|
if (IS_ERR(chan))
|
||||||
return PTR_ERR(chan);
|
return PTR_ERR(chan);
|
||||||
|
|
||||||
gpuobj = nouveau_ramht_find(chan, objfree->handle);
|
ret = nouveau_ramht_remove(chan, objfree->handle);
|
||||||
if (gpuobj) {
|
|
||||||
nouveau_ramht_remove(chan, objfree->handle);
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
nouveau_channel_put(&chan);
|
nouveau_channel_put(&chan);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -214,18 +214,19 @@ out:
|
|||||||
spin_unlock_irqrestore(&chan->ramht->lock, flags);
|
spin_unlock_irqrestore(&chan->ramht->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
nouveau_ramht_remove(struct nouveau_channel *chan, u32 handle)
|
nouveau_ramht_remove(struct nouveau_channel *chan, u32 handle)
|
||||||
{
|
{
|
||||||
struct nouveau_ramht_entry *entry;
|
struct nouveau_ramht_entry *entry;
|
||||||
|
|
||||||
entry = nouveau_ramht_remove_entry(chan, handle);
|
entry = nouveau_ramht_remove_entry(chan, handle);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return;
|
return -ENOENT;
|
||||||
|
|
||||||
nouveau_ramht_remove_hash(chan, entry->handle);
|
nouveau_ramht_remove_hash(chan, entry->handle);
|
||||||
nouveau_gpuobj_ref(NULL, &entry->gpuobj);
|
nouveau_gpuobj_ref(NULL, &entry->gpuobj);
|
||||||
kfree(entry);
|
kfree(entry);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nouveau_gpuobj *
|
struct nouveau_gpuobj *
|
||||||
|
@ -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,
|
extern int nouveau_ramht_insert(struct nouveau_channel *, u32 handle,
|
||||||
struct nouveau_gpuobj *);
|
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 *
|
extern struct nouveau_gpuobj *
|
||||||
nouveau_ramht_find(struct nouveau_channel *chan, u32 handle);
|
nouveau_ramht_find(struct nouveau_channel *chan, u32 handle);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user