[PATCH] i810_dma.c: fix pointer arithmetic for 64-bit target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



CC [M]  drivers/char/drm/i810_dma.o
drivers/char/drm/i810_dma.c: In function 'i810_map_buffer':
drivers/char/drm/i810_dma.c:147: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c: In function 'i810_dma_dispatch_vertex':
drivers/char/drm/i810_dma.c:811: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c:811: warning: cast to pointer from integer of different size
drivers/char/drm/i810_dma.c: In function 'i810_dma_dispatch_mc':
drivers/char/drm/i810_dma.c:1169: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c:1169: warning: cast to pointer from integer of different size

First warning result from open-coded PTR_ERR,
the rest is caused by code like this:

*(u32 *) ((u32) buf_priv->kernel_virtual + used)

Patch fixes this. Please apply.
--
vda
CC [M]  drivers/char/drm/i810_dma.o
drivers/char/drm/i810_dma.c: In function 'i810_map_buffer':
drivers/char/drm/i810_dma.c:147: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c: In function 'i810_dma_dispatch_vertex':
drivers/char/drm/i810_dma.c:811: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c:811: warning: cast to pointer from integer of different size
drivers/char/drm/i810_dma.c: In function 'i810_dma_dispatch_mc':
drivers/char/drm/i810_dma.c:1169: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c:1169: warning: cast to pointer from integer of different size

--- linux-2.6.17.8.src/drivers/char/drm/i810_dma.c.org	2006-08-07 06:18:54.000000000 +0200
+++ linux-2.6.17.8.src/drivers/char/drm/i810_dma.c	2006-08-12 20:56:10.000000000 +0200
@@ -141,10 +141,10 @@ static int i810_map_buffer(drm_buf_t * b
 					    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);
@@ -808,7 +808,7 @@ static void i810_dma_dispatch_vertex(drm
 		    ((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;
 		}
 
@@ -1166,7 +1166,7 @@ static void i810_dma_dispatch_mc(drm_dev
 
 	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;
 		}
 

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux