Skip to contentSkip to conversation

Fix printk format vs argument warning

PATCH In review David Howells 3 participants 3 messages Jul 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix printk format vs argument warning

The attached patch makes the argument to this printk in calibrate_migration_costs() always long to match the format string.

---
warthog>diffstat -p1 format-arg-size-2612mm1-10.diff

 kernel/sched.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
kernel/sched.c +1 -1
diff -uNrp linux-2.6.12-mm1/kernel/sched.c linux-2.6.12-mm1-cachefs-wander/kernel/sched.c
@@ -5572,7 +5572,7 @@ void __devinit calibrate_migration_costs
 	printk("| migration cost matrix (max_cache_size: %d, cpu: %ld MHz):\n",
 			max_cache_size,
 #ifdef CONFIG_X86
-			cpu_khz/1000
+			cpu_khz/1000L
 #else
 			-1L
 #endif
#1 lore raw
Quoted 3 lines · David Howells

The attached patch makes the argument to this printk in
calibrate_migration_costs() always long to match the format string.

That darn printk again. You wouldn't believe...

calibrate_migration_costs() causes a storm of boot-time output and I think all those printks should be removed before this code goes up to Linus. Maybe split out into a separate -mm-only patch?

Quoted 6 lines

---
warthog>diffstat -p1 format-arg-size-2612mm1-10.diff

  kernel/sched.c |    2 +-
  1 files changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines

diff -uNrp linux-2.6.12-mm1/kernel/sched.c linux-2.6.12-mm1-cachefs-wander/kernel/sched.c
--- linux-2.6.12-mm1/kernel/sched.c 2005-06-22 13:54:08.000000000 +0100
+++ linux-2.6.12-mm1-cachefs-wander/kernel/sched.c 2005-06-22 14:10:57.000000000 +0100
@@ -5572,7 +5572,7 @@ void __devinit calibrate_migration_costs
printk("| migration cost matrix (max_cache_size: %d, cpu: %ld MHz):\n",
max_cache_size,
#ifdef CONFIG_X86
- cpu_khz/1000
+ cpu_khz/1000L
#else

It's currently %d in my tree. This is why I converted x86's cpu_khz from unsigned long to unsigned, to match x86_64's.

#2 lore raw
Quoted 3 lines · Andrew Morton

calibrate_migration_costs() causes a storm of boot-time output and I think all those printks should be removed before this code goes up to Linus. Maybe split out into a separate -mm-only patch?

it was only a debugging measure. Patch below turns off.

------
turn off migration debugging.

 kernel/sched.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
kernel/sched.c +1 -1
Index: linux-sched-curr/kernel/sched.c
===================================================================
@@ -5043,7 +5043,7 @@ __init static unsigned long domain_dista
 	return distance;
 }
 
-static __initdata unsigned int migration_debug = 1;
+static __initdata unsigned int migration_debug = 0;
 
 static int __init setup_migration_debug(char *str)
 {