mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-07 19:18:04 +02:00
Fixed link list bug in agp_free
This commit is contained in:
parent
b1d3a9405e
commit
fcb9e630da
1 changed files with 13 additions and 2 deletions
|
|
@ -166,6 +166,8 @@ int drm_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
|
|||
-EFAULT);
|
||||
if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS)))
|
||||
return -ENOMEM;
|
||||
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
|
||||
pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
type = (u32) request.type;
|
||||
|
|
@ -181,8 +183,11 @@ int drm_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
|
|||
entry->pages = pages;
|
||||
entry->prev = NULL;
|
||||
entry->next = dev->agp->memory;
|
||||
printk("dev->agp->memory : %p\n", dev->agp->memory);
|
||||
printk("entry : %p\n", entry);
|
||||
if (dev->agp->memory) dev->agp->memory->prev = entry;
|
||||
dev->agp->memory = entry;
|
||||
printk("dev->agp->memory : %p\n", dev->agp->memory);
|
||||
|
||||
request.handle = entry->handle;
|
||||
request.physical = memory->physical;
|
||||
|
|
@ -263,9 +268,15 @@ int drm_agp_free(struct inode *inode, struct file *filp, unsigned int cmd,
|
|||
-EFAULT);
|
||||
if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
|
||||
return -EINVAL;
|
||||
#if 0
|
||||
if (entry->bound) drm_unbind_agp(entry->memory);
|
||||
entry->prev->next = entry->next;
|
||||
entry->next->prev = entry->prev;
|
||||
#endif
|
||||
if(entry->prev) entry->prev->next = entry->next;
|
||||
if(entry->next) entry->next->prev = entry->prev;
|
||||
if((entry->next == NULL) &&
|
||||
(entry->prev == NULL)) {
|
||||
dev->agp->memory = NULL;
|
||||
}
|
||||
drm_free_agp(entry->memory, entry->pages);
|
||||
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue