Patchwork mtdswap: fix printk format warning

login
register
mail settings
Submitter Randy Dunlap
Date March 29, 2011, 7:35 p.m.
Message ID <20110329123523.74735727.randy.dunlap@oracle.com>
Download mbox | patch
Permalink /patch/88841/
State Accepted
Commit 2130ad32a03f8d2d772cbbd94eff5358d8ab9e33
Headers show

Comments

Randy Dunlap - March 29, 2011, 7:35 p.m.
From: Randy Dunlap <randy.dunlap@oracle.com>

The number is actually a sizeof(), so using %zu for it builds
cleanly on 32-bit or 64-bit.

drivers/mtd/mtdswap.c:1456: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'unsigned int'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 drivers/mtd/mtdswap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Artem Bityutskiy - April 1, 2011, 8:30 a.m.
On Tue, 2011-03-29 at 12:35 -0700, Randy Dunlap wrote:
> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> The number is actually a sizeof(), so using %zu for it builds
> cleanly on 32-bit or 64-bit.
> 
> drivers/mtd/mtdswap.c:1456: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'unsigned int'
> 
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>

Pushed to l2-mtd-2.6.git tree, thanks.

Patch

--- linux-next-20110329.orig/drivers/mtd/mtdswap.c
+++ linux-next-20110329/drivers/mtd/mtdswap.c
@@ -1452,7 +1452,7 @@  static void mtdswap_add_mtd(struct mtd_b
 	oinfo = mtd->ecclayout;
 	if (!mtd->oobsize || !oinfo || oinfo->oobavail < MTDSWAP_OOBSIZE) {
 		printk(KERN_ERR "%s: Not enough free bytes in OOB, "
-			"%d available, %lu needed.\n",
+			"%d available, %zu needed.\n",
 			MTDSWAP_PREFIX, oinfo->oobavail, MTDSWAP_OOBSIZE);
 		return;
 	}