summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2006-08-19 16:31:34 +1000
committerDave Airlie <airlied@linux.ie>2006-08-19 16:31:34 +1000
commitf89a576aece919f2f9bd42b7d36a5df62cb0d68e (patch)
tree73f65c8d3afdcdec2b443da1adc2012bced13794
parent0316f93d51abc52b816e936e0ece304ac47799c3 (diff)
drm: i810_dma.c: fix pointer arithmetic for 64-bit target
First warning result from open-coded PTR_ERR, the rest is caused by code like this: *(u32 *) ((u32) buf_priv->kernel_virtual + used) I've also fixed a missing PTR_ERR in i830_dma.c From: Denis Vlasenko <vda.linux@googlemail.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
-rw-r--r--linux-core/i810_dma.c8
-rw-r--r--linux-core/i830_dma.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index 800c5f61..27d8efb9 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -166,10 +166,10 @@ static int i810_map_buffer(drm_buf_t * buf, struct file *filp)
MAP_SHARED, buf->bus_address);
dev_priv->mmap_buffer = NULL;
filp->f_op = old_fops;
- if ((unsigned long)buf_priv->virtual > -1024UL) {
+ if (IS_ERR(buf_priv->virtual)) {
/* Real error */
DRM_ERROR("mmap error\n");
- retcode = (signed int)buf_priv->virtual;
+ retcode = PTR_ERR(buf_priv->virtual);
buf_priv->virtual = NULL;
}
up_write(&current->mm->mmap_sem);
@@ -833,7 +833,7 @@ static void i810_dma_dispatch_vertex(drm_device_t * dev,
((GFX_OP_PRIMITIVE | prim | ((used / 4) - 2)));
if (used & 4) {
- *(u32 *) ((u32) buf_priv->kernel_virtual + used) = 0;
+ *(u32 *) ((char *) buf_priv->kernel_virtual + used) = 0;
used += 4;
}
@@ -1191,7 +1191,7 @@ static void i810_dma_dispatch_mc(drm_device_t * dev, drm_buf_t * buf, int used,
if (buf_priv->currently_mapped == I810_BUF_MAPPED) {
if (used & 4) {
- *(u32 *) ((u32) buf_priv->virtual + used) = 0;
+ *(u32 *) ((char *) buf_priv->virtual + used) = 0;
used += 4;
}
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index a122898b..9694f64a 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -155,7 +155,7 @@ static int i830_map_buffer(drm_buf_t * buf, struct file *filp)
if (IS_ERR((void *)virtual)) { /* ugh */
/* Real error */
DRM_ERROR("mmap error\n");
- retcode = virtual;
+ retcode = PTR_ERR((void *)virtual);
buf_priv->virtual = NULL;
} else {
buf_priv->virtual = (void __user *)virtual;