summaryrefslogtreecommitdiff
path: root/linux/drm_dma.h
diff options
context:
space:
mode:
authorLeif Delgass <ldelgass@users.sourceforge.net>2003-04-25 19:42:47 +0000
committerLeif Delgass <ldelgass@users.sourceforge.net>2003-04-25 19:42:47 +0000
commitcb32dde3be831096e98c66398159f7d7ddf3d672 (patch)
tree2faa4dc7e4ba0b0b64300154b49d49805e0fa72b /linux/drm_dma.h
parent77ee73f8cd92aa136488e23424282afba9977160 (diff)
Fix potential oops and memory leaks when allocations fail in
addbufs_agp/pci. Add support for buffer private structs with PCI DMA buffers. Also some debug format string fixes.
Diffstat (limited to 'linux/drm_dma.h')
-rw-r--r--linux/drm_dma.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/linux/drm_dma.h b/linux/drm_dma.h
index 640e245d..7c1785b4 100644
--- a/linux/drm_dma.h
+++ b/linux/drm_dma.h
@@ -84,22 +84,24 @@ void DRM(dma_takedown)(drm_device_t *dev)
dma->bufs[i].buf_count,
dma->bufs[i].seg_count);
for (j = 0; j < dma->bufs[i].seg_count; j++) {
- DRM(free_pages)(dma->bufs[i].seglist[j],
- dma->bufs[i].page_order,
- DRM_MEM_DMA);
+ if (dma->bufs[i].seglist[j]) {
+ DRM(free_pages)(dma->bufs[i].seglist[j],
+ dma->bufs[i].page_order,
+ DRM_MEM_DMA);
+ }
}
DRM(free)(dma->bufs[i].seglist,
dma->bufs[i].seg_count
* sizeof(*dma->bufs[0].seglist),
DRM_MEM_SEGS);
}
- if(dma->bufs[i].buf_count) {
- for(j = 0; j < dma->bufs[i].buf_count; j++) {
- if(dma->bufs[i].buflist[j].dev_private) {
- DRM(free)(dma->bufs[i].buflist[j].dev_private,
- dma->bufs[i].buflist[j].dev_priv_size,
- DRM_MEM_BUFS);
- }
+ if (dma->bufs[i].buf_count) {
+ for (j = 0; j < dma->bufs[i].buf_count; j++) {
+ if (dma->bufs[i].buflist[j].dev_private) {
+ DRM(free)(dma->bufs[i].buflist[j].dev_private,
+ dma->bufs[i].buflist[j].dev_priv_size,
+ DRM_MEM_BUFS);
+ }
}
DRM(free)(dma->bufs[i].buflist,
dma->bufs[i].buf_count *