Skip to contentSkip to conversation

MTD: fix printk format warning

PATCH In review Randy Dunlap 3 participants 5 messages Oct 24, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTD: fix printk format warning

From: Randy Dunlap <[email protected]>

(may be a gcc phenomenon)
Fix printk format warning:
drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)

---

 drivers/mtd/maps/physmap.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/physmap.c +1 -1
@@ -89,7 +89,7 @@ static int physmap_flash_probe(struct pl
 		return -ENODEV;
 
        	printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n",
-	    (unsigned long long)dev->resource->end - dev->resource->start + 1,
+	    (unsigned long long)(dev->resource->end - dev->resource->start + 1),
 	    (unsigned long long)dev->resource->start);
 
 	info = kmalloc(sizeof(struct physmap_flash_info), GFP_KERNEL);

---

#1 lore raw
Quoted 5 lines · Randy Dunlap

(may be a gcc phenomenon)
Fix printk format warning:
drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)

... snip ...

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct pl · line 93

Quoted 4 lines

printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n",

drivers/mtd/maps/physmap.c +1 -1
-	    (unsigned long long)dev->resource->end - dev->resource->start + 1,
+	    (unsigned long long)(dev->resource->end - dev->resource->start + 1),
 	    (unsigned long long)dev->resource->start);

Hmm, AFAIK

"(unsigned long) dev->resource->end - dev->resource->start + 1" should

end up with unsigned long, so why not to fix gcc instead?

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)
#2 lore raw
Quoted 9 lines · Artem Bityutskiy
Quoted 5 lines · Randy Dunlap

(may be a gcc phenomenon)
Fix printk format warning:
drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)

... snip ...

Quoted 8 lines

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct pl · line 93

Quoted 4 lines

printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n",

drivers/mtd/maps/physmap.c +1 -1
-	    (unsigned long long)dev->resource->end - dev->resource->start + 1,
+	    (unsigned long long)(dev->resource->end - dev->resource->start + 1),
 	    (unsigned long long)dev->resource->start);

Hmm, AFAIK

"(unsigned long) dev->resource->end - dev->resource->start + 1" should

I thought that 'z' was the modifier to %x for resources?

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#3 lore raw
Quoted 15 lines · Ben Dooks
Quoted 14 lines · Artem Bityutskiy
Quoted 5 lines · Randy Dunlap

(may be a gcc phenomenon)
Fix printk format warning:
drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)

... snip ...

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct pl · line 93

Quoted 4 lines

printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n",

drivers/mtd/maps/physmap.c +1 -1
-	    (unsigned long long)dev->resource->end - dev->resource->start + 1,
+	    (unsigned long long)(dev->resource->end - dev->resource->start + 1),
 	    (unsigned long long)dev->resource->start);

Hmm, AFAIK

Quoted 3 lines
Quoted 1 line

"(unsigned long) dev->resource->end - dev->resource->start + 1" should

I thought that 'z' was the modifier to %x for resources?

Maybe you are thinking of 'z' for use with size_t ? From the C99 spec:

z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument. But a resource_size_t is not a size_t. Depending on CONFIG, it's either:

#ifdef CONFIG_RESOURCES_64BIT
typedef u64 resource_size_t;
#else
typedef u32 resource_size_t;
#endif

which I suppose is what Artem missed. I.e., it's not always unsigned long. However, I won't deny that gcc seems odd here.

Signature · 1 line
~Randy
#4 lore raw
Quoted 2 lines · Randy.Dunlap

which I suppose is what Artem missed. I.e., it's not always unsigned long. However, I won't deny that gcc seems odd here.

I just wanted to say that (unsigned long)a - b + 1 has "unsigned long" type even if "a" and "b" are u32 or u64. I would have understood you if you had said that you cut "a" because of the u64->unsigned long casting, but I understood that the rationale for the change was to fix print format warning...

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)