All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i810_dma.c: fix pointer arithmetic for 64-bit target
@ 2006-08-13 12:30 Denis Vlasenko
  0 siblings, 0 replies; only message in thread
From: Denis Vlasenko @ 2006-08-13 12:30 UTC (permalink / raw)
  To: Rik Faith, Jeff Hartmann, Keith Whitwell, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

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

[-- Attachment #2: i810_dma.c.diff --]
[-- Type: text/x-diff, Size: 1852 bytes --]

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;
 		}
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-13 12:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-13 12:30 [PATCH] i810_dma.c: fix pointer arithmetic for 64-bit target Denis Vlasenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.