summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Delgass <ldelgass@users.sourceforge.net>2003-04-28 16:20:31 +0000
committerLeif Delgass <ldelgass@users.sourceforge.net>2003-04-28 16:20:31 +0000
commita57d3204613922ee07e56209169e4b4ce1f17754 (patch)
treea25d15a6ece180fc172f6bb17ed5fce34c0847d3
parent6eb5364eb81474a6ceac8b44c3283cb0327b2a82 (diff)
Only free original pagelist in addbufs_pci if one already exists (fixes
oops).
-rw-r--r--linux-core/drm_bufs.c12
-rw-r--r--linux/drm_bufs.h12
2 files changed, 14 insertions, 10 deletions
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index 0fb4376c..84a9a611 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -146,7 +146,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
#ifdef __alpha__
map->offset += dev->hose->mem_space->start;
#endif
- map->offset = map->offset + dev->agp->base;
+ map->offset += dev->agp->base;
map->mtrr = dev->agp->agp_mtrr; /* for getmap */
break;
#endif
@@ -155,7 +155,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
return -EINVAL;
}
- map->offset = map->offset + dev->sg->handle;
+ map->offset += dev->sg->handle;
break;
default:
@@ -681,9 +681,11 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp,
/* No allocations failed, so now we can replace the orginal pagelist
* with the new one.
*/
- DRM(free)(dma->pagelist,
- dma->page_count * sizeof(*dma->pagelist),
- DRM_MEM_PAGES);
+ if (dma->page_count) {
+ DRM(free)(dma->pagelist,
+ dma->page_count * sizeof(*dma->pagelist),
+ DRM_MEM_PAGES);
+ }
dma->pagelist = temp_pagelist;
dma->buf_count += entry->buf_count;
diff --git a/linux/drm_bufs.h b/linux/drm_bufs.h
index 0fb4376c..84a9a611 100644
--- a/linux/drm_bufs.h
+++ b/linux/drm_bufs.h
@@ -146,7 +146,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
#ifdef __alpha__
map->offset += dev->hose->mem_space->start;
#endif
- map->offset = map->offset + dev->agp->base;
+ map->offset += dev->agp->base;
map->mtrr = dev->agp->agp_mtrr; /* for getmap */
break;
#endif
@@ -155,7 +155,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
return -EINVAL;
}
- map->offset = map->offset + dev->sg->handle;
+ map->offset += dev->sg->handle;
break;
default:
@@ -681,9 +681,11 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp,
/* No allocations failed, so now we can replace the orginal pagelist
* with the new one.
*/
- DRM(free)(dma->pagelist,
- dma->page_count * sizeof(*dma->pagelist),
- DRM_MEM_PAGES);
+ if (dma->page_count) {
+ DRM(free)(dma->pagelist,
+ dma->page_count * sizeof(*dma->pagelist),
+ DRM_MEM_PAGES);
+ }
dma->pagelist = temp_pagelist;
dma->buf_count += entry->buf_count;