Bugzilla #3217: Create a new __drm_pci_free which is used internally in

linux-core to free pci memory without freeing the structure. Linux-core
    internals often create pci dma handle structures on the stack due to
    the lack of a drm_local_map_t to store them in properly. Fix the
    original drm_pci_free to actually free the dma handle structure instead
    of leaking it.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
This commit is contained in:
Eric Anholt 2005-05-28 20:36:22 +00:00
parent d7756397d6
commit 9cad6fb4e0
5 changed files with 19 additions and 5 deletions

View file

@ -992,6 +992,7 @@ extern int drm_ati_pcigart_cleanup(drm_device_t * dev,
extern drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size,
size_t align, dma_addr_t maxaddr);
extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah);
extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah);
/* sysfs support (drm_sysfs.c) */

View file

@ -269,6 +269,7 @@ int drm_addmap(struct inode *inode, struct file *filp,
}
map->handle = dmah->vaddr;
map->offset = (unsigned long)dmah->busaddr;
kfree(dmah);
break;
}
default:
@ -380,7 +381,7 @@ int drm_rmmap(struct inode *inode, struct file *filp,
dmah.vaddr = map->handle;
dmah.busaddr = map->offset;
dmah.size = map->size;
drm_pci_free(dev, &dmah);
__drm_pci_free(dev, &dmah);
break;
}
drm_free(map, sizeof(*map), DRM_MEM_MAPS);

View file

@ -235,7 +235,7 @@ int drm_takedown(drm_device_t * dev)
dmah.vaddr = map->handle;
dmah.busaddr = map->offset;
dmah.size = map->size;
drm_pci_free(dev, &dmah);
__drm_pci_free(dev, &dmah);
break;
}
drm_free(map, sizeof(*map), DRM_MEM_MAPS);

View file

@ -122,10 +122,12 @@ drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align,
EXPORT_SYMBOL(drm_pci_alloc);
/**
* \brief Free a PCI consistent memory block.
* \brief Free a PCI consistent memory block without freeing its descriptor.
*
* This function is for internal use in the Linux-specific DRM core code.
*/
void
drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah)
__drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah)
{
#if 0
unsigned long addr;
@ -169,6 +171,16 @@ drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah)
#endif
}
/**
* \brief Free a PCI consistent memory block.
*/
void
drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah)
{
__drm_pci_free(dev, dmah);
kfree(dmah);
}
EXPORT_SYMBOL(drm_pci_free);
/*@}*/

View file

@ -242,7 +242,7 @@ void drm_vm_shm_close(struct vm_area_struct *vma)
dmah.vaddr = map->handle;
dmah.busaddr = map->offset;
dmah.size = map->size;
drm_pci_free(dev, &dmah);
__drm_pci_free(dev, &dmah);
break;
}
drm_free(map, sizeof(*map), DRM_MEM_MAPS);