diff options
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/longhaul.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c index 8ef38544453c..31600576b7ee 100644 --- a/arch/i386/kernel/cpu/cpufreq/longhaul.c +++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c | |||
@@ -77,13 +77,17 @@ static char speedbuffer[8]; | |||
77 | 77 | ||
78 | static char *print_speed(int speed) | 78 | static char *print_speed(int speed) |
79 | { | 79 | { |
80 | if (speed > 1000) { | 80 | if (speed < 1000) { |
81 | if (speed%1000 == 0) | 81 | snprintf(speedbuffer, sizeof(speedbuffer),"%dMHz", speed); |
82 | sprintf (speedbuffer, "%dGHz", speed/1000); | 82 | return speedbuffer; |
83 | else | 83 | } |
84 | sprintf (speedbuffer, "%d.%dGHz", speed/1000, (speed%1000)/100); | 84 | |
85 | } else | 85 | if (speed%1000 == 0) |
86 | sprintf (speedbuffer, "%dMHz", speed); | 86 | snprintf(speedbuffer, sizeof(speedbuffer), |
87 | "%dGHz", speed/1000); | ||
88 | else | ||
89 | snprintf(speedbuffer, sizeof(speedbuffer), | ||
90 | "%d.%dGHz", speed/1000, (speed%1000)/100); | ||
87 | 91 | ||
88 | return speedbuffer; | 92 | return speedbuffer; |
89 | } | 93 | } |