Re: [PATCH] zoran: Fix a warning on x86_64

Trent Piepho <[email protected]>
Newsgroups gmane.comp.video.mjpeg.devel
Message-ID <[email protected]>
On Thu, 24 May 2007, Jean Delvare wrote:
> Fix the following warning on x86_64:
>
> drivers/media/video/zoran_driver.c: In function "v4l_fbuffer_alloc":
> drivers/media/video/zoran_driver.c:387: warning: cast from pointer to integer of different size
>
> Signed-off-by: Jean Delvare <[email protected]>
> ---
>  drivers/media/video/zoran_driver.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- linux-2.6.22-rc2.orig/drivers/media/video/zoran_driver.c	2007-05-24 19:18:48.000000000 +0200
> +++ linux-2.6.22-rc2/drivers/media/video/zoran_driver.c	2007-05-24 19:19:56.000000000 +0200
> @@ -386,8 +386,8 @@ v4l_fbuffer_alloc (struct file *file)
>  			    virt_to_bus(mem);
>  			dprintk(4,
>  				KERN_INFO
> -				"%s: Bigphysarea frame %d mem 0x%x (bus: 0x%x)\n",
> -				ZR_DEVNAME(zr), i, (unsigned) mem,
> +				"%s: Bigphysarea frame %d mem 0x%lx (bus: 0x%x)\n",
> +				ZR_DEVNAME(zr), i, (unsigned long) mem,
>  				(unsigned) virt_to_bus(mem));

This isn't quite right.  virt_to_bus() returns an unsigned long, not an
unsigned int.  It actually makes a difference on the 64-bit archs.  There's
no need to cast the pointer to an integer type either, there is the %p code
for printing pointers.

I think the correct code would be:

			"%s: Bigphysarea frame %d mem %p (bus: 0x%lx)\n",
			 ZR_DEVNAME(zr), i, mem, virt_to_bus(mem));

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.