[PATCH 1/2] mtd: fix compiler warnings

Alexander Aring alex.aring at googlemail.com
Wed Sep 5 14:53:29 EDT 2012


Hi,

I saw it on sandbox platform. Does this depend on 32 bit or 64 bit system?

I found this for __kernel_size_t:
arch/sandbox/include/asm/posix_types.h:18:typedef unsigned long
__kernel_size_t;

so we need to change this to:
typedef unsigned int    __kernel_size_t;

but in mips arch there is unsigned long, too.

Regards
Alex

2012/9/5 Jan Lübbe <jlu at pengutronix.de>

> Hi,
>
> On Mon, 2012-09-03 at 07:58 +0200, Alexander Aring wrote:
> > Fix some compiler warnings.
> > --- a/drivers/mtd/core.c
> > +++ b/drivers/mtd/core.c
> > @@ -79,7 +79,7 @@ static ssize_t mtd_write(struct cdev* cdev, const void
> *buf, size_t _count,
> >               return -EINVAL;
> >       }
> >
> > -     dev_dbg(cdev->dev, "write: 0x%08lx 0x%08x\n", offset, count);
> > +     dev_dbg(cdev->dev, "write: 0x%08lx 0x%08lx\n", offset, count);
> >       while (count) {
>
> This causes some new warnings for me:
> drivers/mtd/core.c: In function 'mtd_write':
> drivers/mtd/core.c:82:2: warning: format '%08lx' expects type 'long
> unsigned int', but argument 5 has type 'size_t'
> drivers/mtd/core.c:102:4: warning: format '%08lx' expects type 'long
> unsigned int', but argument 5 has type 'size_t'
> drivers/mtd/core.c:102:4: warning: format '%08lx' expects type 'long
> unsigned int', but argument 6 has type 'size_t'
>
> They go away when reverting this. It seems that different achitectures
> have different ideas about size_t:
> ./include/linux/types.h:54:typedef __kernel_size_t              size_t;
> ./arch/ppc/include/asm/posix_types.h:17:typedef unsigned int
>  __kernel_size_t;
> ./arch/blackfin/include/asm/posix_types.h:45:typedef unsigned int
> __kernel_size_t;
> ./arch/mips/include/asm/posix_types.h:34:typedef unsigned int
> __kernel_size_t;
> ./arch/mips/include/asm/posix_types.h:39:typedef unsigned long
>  __kernel_size_t;
> ./arch/x86/include/asm/posix_types.h:34:typedef unsigned int
>  __kernel_size_t;
> ./arch/sandbox/include/asm/posix_types.h:18:typedef unsigned long
> __kernel_size_t;
> ./arch/nios2/include/asm/posix_types.h:30:typedef unsigned int
>  __kernel_size_t;
> ./arch/openrisc/include/asm/posix_types.h:28:typedef unsigned int
> __kernel_size_t;
> ./arch/arm/include/asm/posix_types.h:30:typedef unsigned int
>  __kernel_size_t;
>
> On which arch did you see the warnings with the original code?
>
> Regards,
> Jan
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20120905/9cda5c7b/attachment-0001.html>


More information about the barebox mailing list