* [PATCH] cpufreq: remove redundant sprintf
@ 2011-05-04 15:38 Kees Cook
0 siblings, 0 replies; only message in thread
From: Kees Cook @ 2011-05-04 15:38 UTC (permalink / raw)
To: linux-kernel; +Cc: Dave Jones, cpufreq
Since format string handling is part of request_module, there is no
need to construct the module name. As such, drop the redundant sprintf
and heap usage.
Signed-off-by: Kees Cook <kees.cook@canonical.com>
---
drivers/cpufreq/cpufreq.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 2dafc5c..95eb6cc 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -411,21 +411,14 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
t = __find_governor(str_governor);
if (t == NULL) {
- char *name = kasprintf(GFP_KERNEL, "cpufreq_%s",
- str_governor);
+ int ret;
- if (name) {
- int ret;
+ mutex_unlock(&cpufreq_governor_mutex);
+ ret = request_module("cpufreq_%s", str_governor);
+ mutex_lock(&cpufreq_governor_mutex);
- mutex_unlock(&cpufreq_governor_mutex);
- ret = request_module("%s", name);
- mutex_lock(&cpufreq_governor_mutex);
-
- if (ret == 0)
- t = __find_governor(str_governor);
- }
-
- kfree(name);
+ if (ret == 0)
+ t = __find_governor(str_governor);
}
if (t != NULL) {
--
1.7.4.1
--
Kees Cook
Ubuntu Security Team
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-04 15:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 15:38 [PATCH] cpufreq: remove redundant sprintf Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®