[PATCH V5] staging: goldfish: Fix pointer cast for 32 bits

Greg KH gregkh at linuxfoundation.org
Sat May 9 16:24:04 UTC 2015


On Mon, May 04, 2015 at 03:11:18PM +0200, Peter Senna Tschudin wrote:
> As the first argument of gf_write64() was of type unsigned long, and as
> some calls to gf_write64() were casting the first argument from void *
> to u64 the compiler and/or sparse were printing warnings for casts of
> wrong sizes when compiling for i386.
> 
> This patch changes the type of the first argument of gf_write64() to
> void *, and update calls to the function. This change fixed the
> warnings and allowed to remove casts from 6 calls to gf_write64().
> 
> In addition gf_write64() was renamed to gf_write_ptr() as the name was
> misleading because it only writes 32 bits on 32 bit systems.
> 
> gf_write_dma_addr() was added to handle dma_addr_t values which is
> used at drivers/staging/goldfish/goldfish_audio.c.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
> Signed-off-by: Peter Senna Tschudin <peter.senna at gmail.com>
> ---
> Tested by compilation only for x86 and for x86_64.

This adds two build warnings:

drivers/tty/goldfish.c: In function ‘goldfish_tty_do_write’:
drivers/tty/goldfish.c:62:15: warning: passing argument 1 of ‘gf_write_ptr’ discards ‘const’ qualifier from pointer target type
  gf_write_ptr(buf, base + GOLDFISH_TTY_DATA_PTR,
               ^
In file included from drivers/tty/goldfish.c:24:0:
include/linux/goldfish.h:6:20: note: expected ‘void *’ but argument is of type ‘const char *’
 static inline void gf_write_ptr(void *ptr, void __iomem *portl,
                    ^

So I can't take this.  Please fix up and resend, and always test build your
patches...

thanks,

greg k-h


More information about the devel mailing list